I would like to use UTC for the scheduling times in a crontab for a single user, regardless of the current time zone of the server. How do I do this on Debian Etch?
-
http://unix.stackexchange.com/questions/195818/change-the-time-zone-of-a-cronjob – Ciro Santilli OurBigBook.com Dec 07 '15 at 20:25
2 Answers
you can set the variable TZ
in /etc/default/cron
. but this is the timezone for all crontabs.
another alternative is using fcron. the documentation shows an option to set the timezone in each crontab.
- 4,645
- 2
- 23
- 27
Some cron installations use CRON_TZ to set the per-user interpretation of the crontab times.
Here's part of man 5 crontab on Centos 7:
The CRON_TZ variable specifies the time zone specific for the cron table. The user should enter a time according to the specified time zone into the table. The time used for writing into a log file is taken from the local time zone, where the daemon is running
.
Default Debian uses a patched vixiecron, (per https://wiki.debian.org/cron) and does not support per-user time zone functionality. If you set a variable in the crontab, it passes to the child jobs, but does not affect the TZ of the parent cron job. Debian has a 'cronie' package in experimental that supports the CRON_TZ functionality.
- 111
- 3
-
1Haha. I love how Debian puts cronie in "experimental" when the rest of the Linux world has been using it for 10 years or more. – Michael Hampton Aug 16 '20 at 15:15