Linux 同步时间


最近发现服务器时间和自己电脑的时间差了2分钟。

于是检查了下,发现是亚马逊的时间服务器差了2分钟,这个坑啊。
于是换了一个。

# crontab -e     // 每隔一小时同步更新一次时间
* */1 * * * ntpdate pool.ntp.org 

如果crontab中ntpdate不生效,就改用绝对路径的办法
* */1 * * * /usr/sbin/ntpdate pool.ntp.org

有的时候报错:

 3 Dec 16:26:42 ntpdate[12489]: the NTP socket is in use, exiting

需要停止ntpd服务。

service ntpd stop

一切正常。

相关内容

    暂无相关文章