Operating System - HP-UX
1753481 Members
4467 Online
108794 Solutions
New Discussion юеВ

set European Time on US HP-UX Box

 
SOLVED
Go to solution
panchpan
Regular Advisor

set European Time on US HP-UX Box

Hello.
I have an environment file. All the shell scripts of my application gets executed after reading environment file. The application is installed on US HP-UX box i.e. CST timings. Is there any way or command by which I could run all the shells in CET timings instead of system time (CST)?

Thank you!
7 REPLIES 7
Pete Randall
Outstanding Contributor
Solution

Re: set European Time on US HP-UX Box

Set the TZ variable to CET.


Pete

Pete
Yang Qin_1
Honored Contributor

Re: set European Time on US HP-UX Box

You can try to setup TZ:

export TZ=CET

Yang
James R. Ferguson
Acclaimed Contributor

Re: set European Time on US HP-UX Box

Hi:

If you want your server to use the CET timezone for every process, run:

# /sbin/set_parms timezone

...and follow the menu to choose the timezone you want.

If you have an environment file that all of your scripts source (read), then all you need to is:

# export TZ=CET

Regards!

...JRF...
spex
Honored Contributor

Re: set European Time on US HP-UX Box

Hi,

If you are running the scripts through cron:

1) In /etc/TIMEZONE, change "TZ=CST" to "TZ=CET".
2) Restart cron:
/sbin/init.d/cron stop
/sbin/init.d/cron start

Note that changing $TZ does not actually adjust the system clock, it merely changes the local representation of UTC time.

PCS
panchpan
Regular Advisor

Re: set European Time on US HP-UX Box

Hello.
I feel export TZ=CET is a good solution. But would it work fine in day/light saving also, I tried to test it . But does not seem to work fine. See below:

$ date
Tue Oct 31 14:23:55 MET 2006
$ date -u
Tue Oct 31 13:23:59 UTC 2006
$ export TZ=CST
$ date
Tue Oct 31 13:24:10 CST 2006
$ export TZ=UTC
$ date
Tue Oct 31 13:24:31 UTC 2006
$ export TZ=CET
$ date
Tue Oct 31 13:24:39 CET 2006
$ unset TZ
$ echo $TZ

$ date
Tue Oct 31 08:25:06 EST 2006
$ export TZ=CET+1
$ date
Tue Oct 31 12:25:40 CET 2006
$


Thank you.
James R. Ferguson
Acclaimed Contributor

Re: set European Time on US HP-UX Box

Hi:

This works:

# TZ=CET date
Tue Oct 31 13:34:16 CET 2006
# TZ=CET1CDT date
Tue Oct 31 12:34:21 CET 2006
# TZ=CET1 date
Tue Oct 31 12:34:26 CET 2006
# TZ=CET-1 date
Tue Oct 31 14:34:32 CET 2006

You can set the TZ variable only for the duration of the command by setting the variable to a value, following that with a whitespace and the command on the same line.

Regards!

...JRF...
spex
Honored Contributor

Re: set European Time on US HP-UX Box

Hi,

$ more /usr/lib/tztab
$ export TZ=CST6CDT
$ date
$ export TZ=MET-1METDST
$ date

PCS