How to change the system time zone
Contents
Abstract[edit]
It may be necesary to change a HP-UX system timezone. Normally, this occured when system are rellocated to new geographical regions. There are to ways to change the system time zone.
The available timezone are define on "/usr/lib/tztab" file. The format of the entries is the following.
0 3 1-7 4 1987-2038 0 UCT5 | | | | | | |> time zone description | | | | | |> day of week (0-6, 0=Sunday) | | | | |> year (range) | | | |> month of year | | |> day of month (range) | |> hour |> minute
Using "set_parms timezone" command[edit]
# set_parms timezone
_______________________________________________________________________________ The following procedure enables you to set the time zone. Select your location from the following list: 1) North America or Hawaii 2) Central America 3) South America 4) Europe 5) Africa 6) Asia 7) Australia, New Zealand 8) Russia / CIS _______________________________________________________________________________
Enter the number for your location (1-7) then press [Enter] 2
_______________________________________________________________________________ You have selected the time zone for all of Central America. _______________________________________________________________________________ Is this correct? Press [y] for yes or [n] for no, then press [Enter] y
_______________________________________________________________________________ Your changes will not take effect until you reboot the system. _______________________________________________________________________________ Do you want to reboot now? Press [y] for yes or [n] for no, then press [Enter] y
Editing timezone files[edit]
To change the system timezone, is necesary to change the contents of two files: /etc/default/tz and /etc/TIMEZONE. The timezone must match between in both files.
The "/etc/TIMEZONE" file is used by daemons that don't have TZ shell variable exported into their environment when they are started. The "/etc/default/tz" is used by processes that relay on the TZ shell variable to keep time tracking.
Example:
# cat /etc/default/tz MST7MDT # cat /etc/TIMEZONE #!/sbin/sh # @(#)B.11.31_LR TZ=MST7MDT export TZ
Notes:
- While it is not strictly required to reboot the system after modifying the rules in the /usr/lib/tztab file, running processes using a timezone with a changed rule need to be restarted to apply the new rules.
- Processes like cron(1M), which depend on proper interpretation of timestamps in the future, must be restarted as soon as possible.
- Processes that only timestamp messages, should be restarted before the changes take effect.
- While it's teoretical possible to establish every individual processes that needs to be restartated, is good policy not to trust that every last one was discovered. The effects of missing a process restart could produce incorrect time stamps or time calculations in the data and applications. Is much better to schedule a maintenance window to reboot the system after changing the system timezone.
References[edit]
Tunable Kernel Parameters
http://www.docs.hp.com/hpux/pdf/TKP-90202.pdf
HP-UX Reference Release 11.0 System Calls and File Formats
http://www.docs.hp.com/hpux/pdf/B2355-90682.pdf
On page 795 tztab file is explained.
DST Changes for HP High Availability Products
http://docs.hp.com/en/9704/ACSL_DST_Summary.pdf
Authors[edit]
- Editor Scott Marer