Tuesday, May 21, 2013

Issue: Changing the system time zone after installation in Red Hat 5.8



Checked the date with date command.  showing the following output.
[support@smarthost ~]$ date
Wed Feb 13 13:42:57 PST 2013
Checked the /etc/localtime file it was not soft linked to the required timezone.
Hence created a soft link as follows to the /usr/share/zoneinfo/PST8PDT
[root@smarthost ~]# ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime
[root@smarthost ~]# date
Wed Feb 13 21:52:07 UTC 2013
Still showing same old time. Thought about visiting the hwclock command
And the glitch is there, see below:
[root@smarthost ~]# hwclock   --show
Wed 13 Feb 2013 09:49:16 PM UTC -0.411498 seconds
Checked help on the command
[root@smarthost]# hwclock --help
hwclock - query and set the hardware clock (RTC)

Usage: hwclock [function] [options...]
Functions:
  -h | --help         show this help
  -r | --show         read hardware clock and print result
       --set          set the rtc to the time given with --date
  -s | --hctosys      set the system time from the hardware clock
  -w | --systohc      set the hardware clock to the current system time
       --systz        set the system time based on the current timezone
       --adjust       adjust the rtc to account for systematic drift since
                      the clock was last set or adjusted
       --getepoch     print out the kernel's hardware clock epoch value
       --setepoch     set the kernel's hardware clock epoch value to the
                      value given with --epoch
  -v | --version      print out the version of hwclock to stdout

Options:
  -u | --utc          the hardware clock is kept in UTC
       --localtime    the hardware clock is kept in local time
  -f | --rtc=path     special /dev/... file to use instead of default
       --directisa    access the ISA bus directly instead of /dev/rtc
       --badyear      ignore rtc's year because the bios is broken
       --date         specifies the time to which to set the hardware clock
       --epoch=year   specifies the year which is the beginning of the
                      hardware clock's epoch value
       --noadjfile    do not access /etc/adjtime. Requires the use of
                      either --utc or --localtime
       --adjfile=path specifies the path to the adjust file (default is
                      /etc/adjtime)
       --test         do everything except actually updating the hardware
                      clock or anything else
  -D | --debug        debug mode

Ran the following command and magic worked!
[root@smarthost ~]# hwclock -s
[root@smarthost ~]# date
Tue May 21 14:38:32 PDT 2013
chkconfig --level 35 ntpd on
[root@smarthost ~]# date
Tue May 21 14:47:06 PDT 2013

No comments: