分享

linux服务器时间校对

 python_diango 2012-11-09
一、查看服务器时间漂移
[root@localhost ~]# ntpdate -d pool.ntp.org
3 Jun 12:23:02 ntpdate[23209]: ntpdate 4.2.2p1@1.1570-o Thu Jan 22 02:50:41 UTC 2009 (1)
Looking for host pool.ntp.org and service ntp
host found : 114.80.81.13
transmit(114.80.81.13)
receive(114.80.81.13)
transmit(114.80.81.13)
receive(114.80.81.13)
transmit(114.80.81.13)
receive(114.80.81.13)
transmit(114.80.81.13)
receive(114.80.81.13)
transmit(114.80.81.13)
transmit(114.80.81.12)
receive(114.80.81.12)
transmit(114.80.81.12)
receive(114.80.81.12)
transmit(114.80.81.12)
receive(114.80.81.12)
transmit(114.80.81.12)
receive(114.80.81.12)
transmit(114.80.81.12)
server 114.80.81.13, port 123
stratum 2, precision -19, leap 00, trust 000
refid [114.80.81.13], delay 0.07500, dispersion 0.00000
transmitted 4, in filter 4
reference time:    cfb1abe6.c1705427 Thu, Jun 3 2010 12:19:50.755
originate timestamp: cfb1aca6.e02c965f Thu, Jun 3 2010 12:23:02.875
transmit timestamp: cfb1aca6.72dc3bd5 Thu, Jun 3 2010 12:23:02.448
filter delay: 0.07510 0.07500 0.07520 0.07578 
         0.00000 0.00000 0.00000 0.00000 
filter offset: 0.401860 0.401864 0.401836 0.401890
         0.000000 0.000000 0.000000 0.000000
delay 0.07500, dispersion 0.00000
offset 0.401864
server 114.80.81.12, port 123
stratum 2, precision -19, leap 00, trust 000
refid [114.80.81.12], delay 0.07466, dispersion 0.00002
transmitted 4, in filter 4
reference time:    cfb1a5be.cab58f10 Thu, Jun 3 2010 11:53:34.791
originate timestamp: cfb1aca7.0fc8e87f Thu, Jun 3 2010 12:23:03.061
transmit timestamp: cfb1aca6.a5c93ea2 Thu, Jun 3 2010 12:23:02.647
filter delay: 0.07474 0.07477 0.07466 0.07497 
         0.00000 0.00000 0.00000 0.00000 
filter offset: 0.389573 0.389545 0.389564 0.389362
         0.000000 0.000000 0.000000 0.000000
delay 0.07466, dispersion 0.00002
offset 0.389564
3 Jun 12:23:02 ntpdate[23209]: adjust time server 114.80.81.12 offset 0.389564 sec
二、服务器时间同步
[root@localhost ~]# ntpdate pool.ntp.org
3 Jun 12:24:52 ntpdate[23216]: adjust time server 114.80.81.12 offset 0.389726 sec
三、将时间同步写入到计划任务
[root@localhost ~]# crontab -l
#Time Synchronization
0 */2 * * * "ntpdate pool.ntp.org">/dev/null 2>&1
四、查看计划任务是否执行
[root@localhost ~]# grep ntpdate /var/log/cron
如果出现下面信息,且每2小时执行一次,说明配置正确
Jun 1 18:00:01 localhost crond[4729]: (root) CMD ("ntpdate pool.ntp.org">/dev/null 2>&1)
Jun 1 20:00:01 localhost crond[5959]: (root) CMD ("ntpdate pool.ntp.org">/dev/null 2>&

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多