Home_greyopenFATE - openSUSE feature tracking > #312961
Dashboard | Search | Sign up | Login

Please login or register to be able to edit or vote this feature.

Timezone aware cron

Feature state

Package Wishlist
Unconfirmed

Description

With this push yesterday:

changeset:   8439:51a23ac0d2a6 
user: Chris Gerhard <Chris.Gerhard@sun.com>
date: Tue Dec 23 15:44:14 2008 +0000
files: usr/src/cmd/cron/Makefile usr/src/cmd/cron/cron.c usr/src/cmd/cron/cron.h usr/src/cmd/cron/crontab.c usr/src/cmd/cron/funcs.c
description:
PSARC/2007/503 crontab entry environment variables
6518038 cron & crontab should support multiple timezones

OpenSolaris finally contains a version of cron that understands and correctly handles having different timezones. You can also specify a different home directory (useful when you don't want NFS to get involved in your cron job for any reason) and shell to run jobs in. It should be in build 106 of OpenSolaris & Nevada.

This brings you crontab in line with at(1) which has been timezone aware for some time.

To use simply set the variables HOME, TZ and SHELL in your crontab file and all subsequent lines will use those values until the next HOME, TZ and SHELL lines are found:

SHELL=/usr/bin/ksh 
TZ=Africa/Abidjan
HOME=/tmp/cg13442
23 \* 1-9,11-26,28-29,31 2-10,12 \* exec /var/tmp/cron/crontest.sh.1.1 23 \\\* 1-9,1
1-26,28-29,31 2-10,12 \\\* Africa/Abidjan
HOME=/var/tmp/cg13442
3 0-7,9-10,12-22 1-6,8-9,11-21,24-26,28 1-7,9-10,12 \* exec /var/tmp/cron/crontes
t.sh.1.1 3 0-7,9-10,12-22 1-6,8-9,11-21,24-26,28 1-7,9-10,12 \\\* Africa/Abidjan
TZ=Africa/Accra
37 0-2,4-5,7-17,20-22 \* \* \* exec /var/tmp/cron/crontest.sh.1.1 37 0-2,4-5,7-17,2
0-22 \\\* \\\* \\\* Africa/Accra

User benefit:

Sun competition.

Saves having to chroot (and maintain) away multiple cron instances for a single account to maintain different "local" timezones.

Usecase

Possibly useful for the Oracle/Sun take-out effort.
You're running a server that needs to be aware of the Summer / Winter time transitions in several timezones for a single application. Say for instance you have cron jobs to do a end-of-day summary for London and New York and Tokyo.

No matter which timezone you set the system to, one of those jobs would run at the wrong time of the day at least one week of the year.

Testcase

SHELL=/usr/bin/ksh
TZ=Africa/Abidjan
HOME=/tmp/cg13442
23 \* 1-9,11-26,28-29,31 2-10,12 \* exec /var/tmp/cron/crontest.sh.1.1 23 \\\* 1-9,1
1-26,28-29,31 2-10,12 \\\* Africa/Abidjan
HOME=/var/tmp/cg13442
3 0-7,9-10,12-22 1-6,8-9,11-21,24-26,28 1-7,9-10,12 \* exec /var/tmp/cron/crontes
t.sh.1.1 3 0-7,9-10,12-22 1-6,8-9,11-21,24-26,28 1-7,9-10,12 \\\* Africa/Abidjan
TZ=Africa/Accra
37 0-2,4-5,7-17,20-22 \* \* \* exec /var/tmp/cron/crontest.sh.1.1 37 0-2,4-5,7-17,2
0-22 \\\* \\\* \\\* Africa/Accra

Discussion


No comments yet

Last change: 2 years ago
Voting
Score: 3
  • Negative: 1
  • Neutral: 1
  • Positive: 4
Tags
Feature Export
Application-xmlXML   Text-x-logPlaintext   PrinterPrint