Linux – How to permanently fix the date synchronize problem in linux

cronlinuxsynctimeubuntu server

Ubuntu 7.10 server i386 clock/date/time won't stay in sync. Are their log files I can view to tell when the clock changes? For a temporary fix, I created a file in /etc/cron.hourly:

#!/bin/sh
ntpdate time.nist.gov

However, this still leaves a potential hour of unchecked time. Is there a cron.minutely? That would still leave a potential minute of unchecked time. I have read about CMOS battery problems, but what if this does not fix it? I'd like to be able to troubleshoot this as a completely software problem.

My squid logs are showing dates back in 2005 when the clock changes, and my time-sensitive access controls are skewed and end up allowing users to surf prohibited websites during business hours.

Best Answer

The advice about running ntpdate is good, but it'll only step your time. A better option is to install ntpd and use it to keep the local clock synchronised, avoiding skewed logs.

With Ubuntu you should just be able to do apt-get install ntp. That should install ntpdate and ntpd, configure them to use ntp.ubuntu.com as the only server and synchronise time. For completeness you'll want to add other NTP servers (eg 0.pool.ntp.org, 1.pool.ntp.org and 2.pool.ntp.org).

Related Question