Operating System - HP-UX
1833016 Members
2260 Online
110048 Solutions
New Discussion

Re: Unusual TIMEZONE problem

 
SOLVED
Go to solution
JUP
Regular Advisor

Unusual TIMEZONE problem

Hi

I have a script that runs only once from the /etc/inittab. This scripts runs a binary and the binary logs any messages with the date & time to a text file. Funny enough the date and times are in a different timezone.

I have checked /etc/TIMEZONE and this is set correctly (to Eastern Australian time).
I have run "set_parms timezone" and set it to Eastern Australian and rebooted.
I log in as root and type "echo $TZ" and get the correct timezone. I type in date and get the correct date and time. I've checked /etc/profile and made sure the TZ is set correctly if /etc/TIMEZONE does not exist.

Why does this binary that gets started via inittab log a timezone that looks like its in the US (ie. about 15 hours late). I am running HP-UX 11.00 on a HP9000 A Class.

Any help would be greatly appreciated.

Thanks in advance
PA
3 REPLIES 3
Michael Tully
Honored Contributor
Solution

Re: Unusual TIMEZONE problem

/etc/inittab is quite dumb, a bit like cron. It does not have the intelligence to know what a PATH is for example. What I suggest is within the script, have it read the /etc/TIMEZONE file as part of variables. e.g. below.

# Set TIMZONE

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
else
TZ=EST-10EDT
export TZ
fi
Anyone for a Mutiny ?
JUP
Regular Advisor

Re: Unusual TIMEZONE problem

Thank you Michael - it worked well.

I placed the following line in the script file:

. /etc/TIMEZONE


Thanks again
PA
Caesar_3
Esteemed Contributor

Re: Unusual TIMEZONE problem

Hello!

In most of cases the scripts that run in startup don't know about the enviroment.
One came befor the other so you need to check this point in every script that you write for the startup process and not depend on the
enviroment that no exists.

Caesar