문제

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?

도움이 되었습니까?

해결책

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 * * *

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top