Re: Why the command 'service ntpd stop' cause the time reversed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 2/11/2015 5:53 PM, David chen wrote:
A shell script is deployed to synchronize time, the script is invoked hourly by crontab, and its content is as follows:
#!/bin/bash
service ntpd stop
ntpdate 192.168.0.191 #it's a valid ntpd server in LAN
service ntpd start
chkconfig ntpd on



huh? ntpd synchronizes time continuously with the given reference servers. why in heck would you stop it to set the clock then restart it ?!?

$ uptime
  6:37pm  up 422 days, 19:38,  1 user,  load average: 0.00, 0.04, 0.06
$ ntptrace
localhost: stratum 3, offset 0.000015, synch distance 0.05679
enigma.wiredgoats.com: stratum 2, offset 0.000249, synch distance 0.04080
lantime.sonic.net: stratum 1, offset -0.000116, synch distance 0.00044, refid 'PPS'

ntpd hasn't been stopped or restarted since that server last booted over a year ago... my time is within 0.000116 seconds, thats 116 microseconds, of the reference server. ntpd works by incrementally fine tuning the speed the system clock runs at, using phase lock loop techniques, so the clock remains monotonic (always increasing) and stable. running a hard time set program can cause the clock to go BACKWARDS if its running fast.

if ntpd isn't working for you properly, you should investigate what ntp servers you're using in /etc/ntp.conf



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux