LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-01-2012, 09:34 PM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
is changing my server's timezone really this difficult?


I've seen a couple of posts that describe changing your timezone on a linux server. They seem unecessarily hard -- the latter requiring 8 steps.

Can anyone tell me how to change my server's timezone from CST to Los Angeles time? I've moved /etc/localtime to /etc/localtime-old and made a link to the Los Angeles time zone file:
Code:
[root@host ~]# mv /etc/localtime /etc/localtime-old
[root@host ~]# ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
and what I type 'date' it how shows the correct and current time in Los Angeles:
Code:
Thu Nov  1 19:26:37 PDT 2012
I'm worried about other daemons or processes that might be running which need to be informed of this change (e.g. cron jobs). I've had issues before where I changed the date but cron jobs kept running at the exact time as before i changed time zones. I'm also wondering what the hardware clock is and whether I need to also update that.

This all seems needlessly complicated IMHO. I hope someone can point me in the right direction.
 
Old 11-02-2012, 02:10 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

Quote:
Originally Posted by sneakyimp View Post
I've seen a couple of posts that describe changing your timezone on a linux server. They seem unecessarily hard -- the latter requiring 8 steps.
Why is this unnecessarily hard? Let's review the steps in the article you are referring to.

1: For ubuntu.... presumably you skipped this as you're not running Ubuntu
2: check which timezone your machine is currently using by executing `date`. You already done this if you know the timezone was CST...
3: Change to the directory /usr/share/zoneinfo here you will find a list of time zone regions. I guess you've done this too if you knew which file to link to
4: If you wish, backup the previous timezone configuration by copying it to a different location. You did this too :-)
5: Create a symbolic link to the appropriate timezone from /etc/localtime. and this...
6: If you have the utility rdate, update the current system time Not really important if you're comfortable that your time is accurate enough
7: Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. "America/Los_Angeles") According to the 1st article you linked to, "Some applications may use the configuration file /etc/sysconfig/clock to determine the current time zone so it's a good idea to set the ZONE entry". I'd therefore perform this step too.
8: Set the hardware clock. Not really important i.m.o., as this is not relevant while Linux is up & running, and most distros will do this during shutdown

Quote:
Originally Posted by sneakyimp View Post
I'm worried about other daemons or processes that might be running which need to be informed of this change (e.g. cron jobs). I've had issues before where I changed the date but cron jobs kept running at the exact time as before i changed time zones. I'm also wondering what the hardware clock is and whether I need to also update that.
I share this concern. Cron is definitely a problem, and some other deamons (like ntpd) may also be. You could just restart the cron daemon to fix that particular issue. Personally I've always rebooted after a timezone change to ensure all deamons are refreshed correctly, as I don't know which others might be affected:-)
 
Old 11-02-2012, 02:27 AM   #3
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
If you are using an Ubuntu system, they have a wiki page on this.

On a system with dpkg, you can generally just use the command line:
Code:
dpkg-reconfigure tzdata
You may need to restart cron:
Code:
/etc/init.d/cron restart
This last point would apply to any daemons that only read the timezone when they start.

The hardware clock is really only needed for startup/shutdown, and will be handled automatically. If you wish to update it, just use:
Code:
hwclock -w
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing timezone and cmos wufo Slackware 2 02-12-2011 08:00 PM
MEPIS's clock keeps changing my timezone newbiesforever MEPIS 2 01-06-2009 01:48 PM
help required for changing timezone from IST to BST manoj.linux Solaris / OpenSolaris 6 10-10-2008 12:11 PM
changing timezone in cli avijitp Linux - Software 7 04-10-2007 11:54 AM
CLI changing of Timezone bretthoward Linux - General 0 08-04-2001 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration