Linux Clock

I have noticed that over the last two years or so, one of my Linux server’s clocks is constantly wrong. Sometimes, it’s off by as little as a minute, but sometimes it’s up to 20 minutes off. When I check it today, it was nearly an hour off. Since it runs many cron jobs, including sending some “reminder” emails to people to enter data into a database, it’s a problem.

Here are the steps I took to fix the problem.

First, I created a script, “clocksync.sh.” This is the contents:

ntpdate clock.redhat.com
/sbin/hwclock --systohc

Then I setup a cronjob to run this once a day. Even running it twice within 5 minutes, the time gets adjusted.

This has fixed the issue well enough, but does anyone know why or how the time could get off by so much? It’s a Dell 400SC server.

Tagged ,