문제

just to verify my understanding of cron-syntax, the following expression will fire on a saturday at 02:42 in the middle of the month, right?

42 02 12-19 * 6 myScript > /dev/null 2>&1

cheers Nicolaie

도움이 되었습니까?

해결책

The script myScript (not good without a path here!) will be executed at 2:42 indeed, on every day between and including the 12th to the 19th of each month that is a saturday.

다른 팁

Actually

42 02 12-19 * 6 myScript > /dev/null 2>&1

means run on 12 thru 19 and every Saturday.

You need a more complex line to do what you state:

0 4 8-14 * * test $(date +\%u) -eq 6 && echo "2nd Saturday"

is an example from the manfile on my system. It uses a trivial execution after making sure it is Saturday.

See http://www.adminschoice.com/crontab-quick-reference/ as well as > man 5 crontab (at the commandline) for more.

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