Operating System - HP-UX
1819804 Members
2919 Online
109607 Solutions
New Discussion юеВ

How to define crontab time zone

 
Joan Sanchez_1
New Member

How to define crontab time zone

Hi,

The time zone crontab is different than other users as root.

Does anyone know how to set up the tz?

Thank you,

Joan
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: How to define crontab time zone

Shalom Joan,

Time zone is a variable set on the system in a file.

All you need to do is make sure the TZ variable is set in the script that is run by cron and anything that is time zone sensitive will work properly.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steve Steel
Honored Contributor

Re: How to define crontab time zone

Hi

cron daemon starts before your /etc/TZ is read

so in cronscript add

export TZ=what you want

example
set|grep TZ
TZ=MET-1METDST

thus
export TZ=TZ=MET-1METDST


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
James R. Ferguson
Acclaimed Contributor

Re: How to define crontab time zone

Hi Joan:

The correct timezone for a server is standardly setup in '/etc/TIMEZONE' which is sourced (read) by '/etc/profile' to propagate the 'TZ' environmental varible into the shell's environment during login.

Any user has the ability to set his/her own TZ value and export it.

You can modify '/etc/TIMEZONE' or you can run :

# /sbin/set_parms timezone

...to "fix" it. You can then restart 'cron' by donng:

# /sbin/init.d/cron stop
# /sbin/init.d/cron start

Regards!

...JRF...