[CentOS] Updating hardware clock from cron
Matt
lm7812 at gmail.com
Fri Mar 4 20:40:48 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.
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.
More information about the CentOS
mailing list