Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top