Entradas Cron no Debian são descritas na página man do crontab ( man 5 crontab
). O Debian usa o cron de Vixie, e sua página man diz:
The crontab syntax does not make it possible to define all possible
periods one could image off. For example, it is not straightforward to
define the last weekday of a month. If a task needs to be run in a spe-
cific period of time that cannot be defined in the crontab syntaxs the
best approach would be to have the program itself check the date and
time information and continue execution only if the period matches the
desired one.
If the program itself cannot do the checks then a wrapper script would
be required. Useful tools that could be used for date analysis are ncal
or calendar For example, to run a program the last Saturday of every
month you could use the following wrapper code:
0 4 * * Sat [ "$(date +%e)" = "'ncal | grep $(date +%a | sed -e 's/.$//')
| sed -e 's/^.*\s\([0-9]\+\)\s*$//''" ] && echo "Last Saturday" &&
program_to_run
Trabalhando assim:
0 0 * * * perl -MTime::Local -e
'exit 1 if (((localtime(time()+60*60*24))[3]) < 2);' || program_to_run