[CentOS] Updating hardware clock from cron

Kenneth Porter shiva at sewingwitch.com
Fri Mar 4 19:15:19 UTC 2011

Is there a package to do this?

Normally the hardware clock is set during shutdown if one is running ntpd. 
But if a long-running server shuts down unexpectedly, this isn't done, and 
the hardware clock might be off by a lot when it comes back up. So setting 
it periodically from a cron job could be useful.

What do others do? Adding a one liner to /etc/cron.daily that invokes 
/etc/rc.d/init.d/ntpd would do it but it seems heavyweight to restart ntpd. 
Alas, the script doesn't export just the sync_hwclock function.

More information about the CentOS mailing list