1832279 Members
2280 Online
110041 Solutions
New Discussion

Time Zone

 
Elizangela Fernandes
Occasional Advisor

Time Zone

Hi All,

Please I need your help.

I`m migrating my environment to United Stated and have a lot of scripts on my crontab.

For example:

05,20,35,50 * * * * /prod12/afl/scripts/pmoftpenv.sh

But on the United States the time is different.

I need to execute this schedule on Brazil date and not on the servers`time.

What I need to do?

Thanks

Elizangela
6 REPLIES 6
Christian Tremblay
Trusted Contributor

Re: Time Zone

Set the timezone parameter for the user who runs the script to Brazil's time in that user's .profile.

TZ=EST3EDT

Belo Horizonte, Brasil, and most other metropolitan areas of
Brasil (including Brasilia).

Kevin Wright
Honored Contributor

Re: Time Zone

Well, you probably got 2 choices.

A) Move the servers to the US, but keep the TZ on the servers to Brazil time.

B) Change all your cronjobs to reflect the date and time you want them to run. (US Time - Brazil time etc)
Peter Godron
Honored Contributor

Re: Time Zone

Hi,
you have two options:
1. Move the cronjob times to Brazilian Time
2. Move the Timezone on the machine to Brasilian time (/etc/TIMEZONE)

For your example there would be no changes at the script is executed 4 times every hour, so no change.
A. Clay Stephenson
Acclaimed Contributor

Re: Time Zone

The cron daemon has 1 setting for TZ regardless of the user. If you want the system-wide time setting to us a US timezone and cron to run on a different TZ setting then use /etc/TIMEZONE to set the default system-wide TZ. Next, modify /sbin/init.d/cron to set and export TZ to your desired value just before the cron daemon itself is invoked.
If it ain't broke, I can fix that.
Christian Tremblay
Trusted Contributor

Re: Time Zone

Correcting myself: Since the user does not login (the job runs from cron), it's .profile won't execute and set the TZ parameter.

I'm not sure you can set it within your crontab....
Peter Godron
Honored Contributor

Re: Time Zone

Elizangela,
do these answers resolve your question?

Please read :
http://forums1.itrc.hp.com/service/forums/helptips.do?#28

Please identify answer and close the thread.