Sunday, May 19, 2013

How to set the timezone on Ubuntu Server

How to set the timezone on Ubuntu Server

How to set the timezone on Ubuntu Server

by IRISH on MARCH 21, 2012
I find it’s pretty annoying when you have to go log file spelunking only to find all the timestamps are in UTC.  But we can set the timezone of the server so when Rails, cron, scripts, etc run, they output more readable dates.
You can check your current timezone by just running
$ date
Thu Mar 21 18:02:49 MST 2012
Or checking the timezone file at
$ more /etc/timezone
US/Arizona
So to change it just run
$ sudo dpkg-reconfigure tzdata
And follow on screen instructions.  Easy.

Also be sure to restart cron as it won’t pick up the timezone change and will still be running on UTC.
$ /etc/init.d/cron stop
$ /etc/init.d/cron start

No comments:

The Network