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.

  • Digg
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Technorati
  • TwitThis
  • Google
  • Fark
  • Reddit
  • Furl
  • SphereIt
  • Pownce
  • E-mail this story to a friend!

If you liked this post, you might like these

2 Comments

roeland says: 2 August 2006 at 12:02 pm

entries we always use in any installation we do:

/usr/sbin/netdate ntp.xs4all.nl > /dev/null
/sbin/hwclock –systohc

in the crontab, pick any time I’d say. can be every day, weekday, minute etc. take your pick ….

there is no general reason why the time drifts. it at least keeps the time correct.

Eugenia says: 2 August 2006 at 12:03 pm

This is a motherboard issue. Its RTC is broken. I suggest you change the mobo.

Leave a comment

:   :   :


You can also create an account, if you'd like.