Monday, March 15, 2010

CentOS change system clock (date) and timezone - Ref: http://linuxsysadminblog.com/2008/12/howto-change-the-timezone-on-rhelcentos/ and http://www.forum.psoft.net/showthread.php?t=13307

Change timezone

Linux systems traditionally keep the definition of their timezone in /etc/localtime. This is a binary file with the timezone info, and if we want to change it we need to find the appropriate timezone file from /usr/share/zoneinfo and copy it over the one from /etc or just link to it. Once you change it, you will need to restart any daemons or applications that use the timezone as they might still use the old one.

Still on RHEL/Centos based systems this is not enough, and even if apparently all seems to work as expected, there might be some applications still using the old timezone. This is happening if they read the timezone definition from the rhel specific file: /etc/sysconfig/clock
cat /etc/sysconfig/clock
ZONE="America/Chicago"
UTC=true
ARC=false

We also need to update the ZONE field in /etc/sysconfig/clock to be sure that all occurrences of the old timezone are changed and everything on the system will use the new setting.

Note: you don’t need to restart the system to activate this change, but you will have to restart the applications using the timezone so they can read the updated information.

Reference:

http://linuxsysadminblog.com/2008/12/howto-change-the-timezone-on-rhelcentos/

 

-----------------------------------------------------------------------------------------------

To Change system date/time

To display the current date/time

$ date

To set the date/time

$ sudo date MMDDhhmmYYYY

Example:

$ sudo date 043017212008

(that is the time of my posting)

MM - Two digit month number
DD - Two digit date
hh - Two digit 24 hour system hour
mm - Two digit minute
YYYY - Four digit year code

Reference:

http://www.forum.psoft.net/showthread.php?t=13307

Print Friendly and PDF
Share/Bookmark

No comments:

Post a Comment