My Server Time is WAY off

November 12, 2009 – 9:16 am |

Well, it was this morning.  I didn’t realize it until I went to schedule a blog post for 12 hours later and it published immediately. I was concerned and actually went to blame WordPress first (I’m really not sure why).  However, when I was looking at the time preferences in the General settings area of the site I noticed something really strange.  My timezone was correct, but the date WP was showing was way off. This meant that my CentOs5 server’s time was way off.

I did a little research and found an article called “Setting the time of your system“.  They gave me some good solutions on how to fix the issue, after reading it I was ready to go.  I tried a couple things in the order they said and found myself a little confused. So naturally, I started trying things till they worked.  This is not always the best solution, but I figured I could deal with a timing issue if I messed it up worse than it was.

For my CentOs 5 server I did the following, which actually worked and set the time perfectly.

First, I checked the date the server had, which turned out to be way off.

# date
  1. Thu Nov 12 23:56:41 MST 2009

Then I looked to see if ntpd (the automatic time adjustment service) was running, it was.

# service ntpd status
  1. ntpd (pid 12019) is running…

I tried ntpdate to reset the time on the server, but it complained about the socket being in use.

# ntpdate 129.6.15.28
  1. 12 Nov 23:57:28 ntpdate[12045]: the NTP socket is in use, exiting

My solution was to stop ntpd and then run ntpdate again, which worked!

# service ntpd stop
  1. Shutting down ntpd:                                        [  OK  ]
  2.  
  3. # ntpdate 129.6.15.28
  4. 12 Nov 07:25:10 ntpdate[12063]: step time server 129.6.15.28 offset -59562.023808 sec

A simple restart of the ntpd service and the time was correct!

# service ntpd start
  1. Starting ntpd:                                             [  OK  ]
  2.  
  3. # date
  4. Thu Nov 12 07:25:20 MST 2009

So, the solution was to do the following steps:

# service ntpd stop
  1. # ntpdate 129.6.15.28
  2. # service ntpd start
  3. #date

I added “date” on the end, because you want to verify that the time actually did reset. Best of Luck!

pixel My Server Time is WAY off

Tagged: , , , , , , , , ,