[CentOS] Updating hardware clock from cron

m.roth at 5-cent.us m.roth at 5-cent.us
Fri Mar 4 20:58:57 UTC 2011


John R Pierce wrote:
> On 03/04/11 12:40 PM, Matt wrote:
>>
>> I add this to /etc/rc.local
>>
>> /usr/sbin/ntpdate us.pool.ntp.org
>>
>> Sets the clock on start up.  Might run it by cron once a month or so
>> too.
>
> thats just the wrong way to go about it.  if your clock is running fast,
> your cronjob will set it backwards, which will cause some interesting
> anomalies in anything time based, could cause a cronjob to trigger
> twice, funny timestamps in emails, etc.
>
> just setup NTP and forget about it, and it will always work right,
> unless your system is really badly broken, whereupon, it would be better
> to fix it than to continue to hack around like this.

Yup. And if you look in your logs, if the system is gracefully shut down,
it syncs the hardware clock with the system time.

         mark




More information about the CentOS mailing list