[CentOS] Why the command 'service ntpd stop' cause the time reversed?
John R Pierce
pierce at hogranch.com
Thu Feb 12 02:41:52 UTC 2015
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
More information about the CentOS
mailing list