0

i have a machine set in GMT. i would like to have a cron task scheduled from 6AM to 5PM in PST, which is GMT-8.

gmt time zone. typical.

00 06-17 * * * 

now -8 produces a crontab bad hour error.

00 22-09 * * *

the following is accepted or should i say, no error.

00 22,23,0,1,2,3,4,5,6,7,8,9 * * *

any short form therefore?

Gabe Rainbow
  • 3,658
  • 4
  • 32
  • 42

3 Answers3

3

For vixie cron,

Lists and ranges are allowed to co-exist in the same field. "1-3,7-9" would be rejected by AT&T or BSD cron -- they want to see "1-3" or "7,8,9" ONLY

That is, the following:

00 22-23,0-9 * * *
Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69
2

You can try by changing the time zone for cron also:

suku@ubuntu-vm:~$ crontab -l | tail -2
TZ=Africa/Tripoli
*   *   *   *   *   date > date.txt
suku@ubuntu-vm:~$ cat date.txt
Thu Jan 10 18:50:01 EET 2013
suku@ubuntu-vm:~$ date
Thu Jan 10 22:20:19 IST 2013
Suku
  • 3,820
  • 1
  • 21
  • 23
1

A good place to try out the basics is the cron simulator at www.dataphyx.com 1

mlbx02
  • 49
  • 2