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
Inspected the Linux log(Centos6.4 /var/log/messages), found the following fragment:
Jan 7 14:00:01 host1 ntpd[32101]: ntpd exiting on signal 15
Jan 7 13:59:59 host1 ntpd[44764]: ntpd 4.2.4p8(a)1.1612-o Fri Feb 22 11:23:27 UTC 2013 (1)
Jan 7 13:59:59 host1 ntpd[44765]: precision = 0.143 usec
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #1 wildcard, ::#123 Disabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #2 lo, ::1#123 Enabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #3 em2, fe80::ca1f:66ff:fee1:eed#123 Enabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #4 lo, 127.0.0.1#123 Enabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on interface #5 em2, 192.168.1.151#123 Enabled
Jan 7 13:59:59 host1 ntpd[44765]: Listening on routing socket on fd #22 for interface updates
Jan 7 13:59:59 host1 ntpd[44765]: kernel time sync status 2040
Jan 7 13:59:59 host1 ntpd[44765]: frequency initialized 499.399 PPM from /var/lib/ntp/drift
Jan 7 14:00:01 host1 ntpd_initres[32103]: parent died before we finished, exiting
Jan 7 14:04:17 host1 ntpd[44765]: synchronized to 192.168.0.191, stratum 2
Jan 7 14:04:17 host1 ntpd[44765]: kernel time sync status change 2001
The script should be executed at 14:00, the first line of the fragment also should indicate that the command 'service ntpd stop' have executed successfully, but why the second line timestamp(13:59:59) is less than the first line's(14:00:01)?
Inspected the Linux log, the problem has happened three times, the time point was Jan 7 14:00:00, Jan 14 14:00:00 and Feb 4 14:00:00 respectively.