1. 在host上执行:
去掉 /etc/ntp.conf 中server行前的注释,Server最后的prefer,表示NTP服务器主要以该部主机时间进行校准,可去掉prefer改参数为time.nist.gov。
ntpdate time.nist.gov
ntpd
2. 在client上执行
ntpdate host
3. 同步到bios
hwclock -w
4.每天执行同步,在/etc/crontab中加一句
30 3 * * * root /usr/sbin/ntpdate node64 && /sbin/hwclock -w >> /dev/null 2>&1
(也许这样才正确 30 3 * * * root /etc/init.d/ntp restart &&/sbin/hwclock -w >>/dev/null 2>&1)
5.设置cron和ntpd服务开机启动为
chkconfig -level 235 cron on
chkconfig -level 35 ntpd on
6.crontab文件说明
1分钟(0-59)
2小时(2-24)
3日期(1-31)
4月份(1-12;或英文缩写Jan、Feb等)
5周几(0-6,0为周日;或单词缩写Sun、Mon等)
6用户名(执行命令时以此用户的身份)
7要执行的命令(路径)