Server time keeps resetting

Posted by Clayton | Posted in Linux, SSH, Tutorial | Posted on 10-16-2009

0

Last night I came across a ticket where a customers time kept resetting on their dedicated server. Typically I would fix the time by using the date command because most of issues I came across the servers were only minutes off. After reading through the clients ticket history I realized that the timezone and minutes were correct, but the hour was still off. After a nice little google search I came across a post on a popular linux forum, where a member had the same issue the client was having. In the post a member suggested creating a symlink for /etc/localtime to point to the clients timezone in the /usr/share/zoneinfo folder. I figured it was worth a shot and tried this fix out, and it worked perfectly :)

Since the client was located in Pakistan, he needed the server to be set to the Asai/Karachi time zone.

root@server [/]# ln -sf /usr/share/zoneinfo/Asia/Karachi /etc/localtime

Before the symlink the time showed in EST but listed the timezone as GMT +5

root@server[/]# date
Mon Jan 26 02:46:24 GMT+5 2009
root@server[/]#

After the symlink the time showed in Asia/Karachi (or GMT +5)

root@server [/]# date
Mon Jan 26 12:48:14 PKT 2009
root@server[/]#

Your localtime file should look like this now:

lrwxrwxrwx  1 root   root       32 Jan 26 12:47 localtime -> /usr/share/zoneinfo/Asia/Karachi

I’m not entirely sure why the date wasn’t correct to begin with as the timezone was correct (+5GMT) when checking with the date command. But, things are fixed now so I really can’t complain since the customer is happy :)

Post a comment

Spam Protection by WP-SpamFree