服务器里面的时间和后台的时间对不上
[attach]7151[/attach][attach]7152[/attach]服务里面的时间和后台的时间对不上,是什么原因,导致网站日志里面的时间慢了12个小时 同步系统时间和硬件时间,可以使用hwclock命令。//以系统时间为基准,修改硬件时间
[root@localhost ~]# hwclock --systohc<== sys(系统时间)to(写到)hc(Hard Clock)
[root@localhost ~]# hwclock -w
//以硬件时间为基准,修改系统时间
[root@localhost ~]# hwclock --hctosys
[root@localhost ~]# hwclock -s
一,用ntpdate从时间服务器更新时间
如果你的linux系统根本没有ntpdate这个命令
yum install ntp
安装完了之后,你不要做什么配置,也不需要,直接测试一下
[root@localhost ~]# ntpdate time.nist.gov
22 Oct 21:11:43 ntpdate[5014]: adjust time server 207.200.81.113 offset -0.018788 sec
如果出去上面的内容说明,同步成功了。然后在crontab里面加上以下内容。
*/10 * * * * ntpdate time.nist.gov #域名或IP
每隔十分钟同步一次。推荐几个时间服务器。
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
页:
[1]