Unix/Linux同步时间方法

根据操作系统相应的程序安装方法,安装ntp程序。

1、通过crontab定期执行ntpdate进行同步。

ntpdate -q ntp.neu6.edu.cn

也可以让系统定期执行该命令,在Shell下输入

crontab -e

在编辑器里面增加如下内容

01 * * * * /usr/sbin/ntpdate -q ntp.neu6.edu.cn

保存即可。

2、以后台守护进程形式进行同步。

在/etc/ntp.conf文件增加

server ntp.neu6.edu.cn
server clock.neu.edu.cn
server ntp.neu.edu.cn

重新启动ntpd程序。