Re: crontab
On 18/11/2013 14:23, Piviul wrote:
Il problema è che con l'impostazione
05 07 14-20 * 7
non avrebbe dovuto eseguirla anche sabato e lunedì invece lo ha fatto
(forse è per quel 7...). Ora comunque ho impostato con:
05 07 14-20 * 0
e domani vi faccio sapere
Non sono esperto di crontab ma nel man [1] c'è scritto:
[quote]
Note: The day of a command's execution can be specified by two fields —
day of month, and day of week. If both fields are restricted (i.e.,
aren't *), the command will be run when either field matches the current
time. For example, ``30 4 1,15 * 5'' would cause a command to be run at
4:30 am on the 1st and 15th of each month, plus every Friday. One can,
however, achieve the desired result by adding a test to the command
[/quote]
In pratica se usi sia il giorno del mese (14-20) che quello della
settimana (0,7,sun) il comando viene eseguito sia dal 14 al 20 *che*
ogni domenica.
Tra gli esempi del man è presente quello che dovrebbe servire a te:
0 4 8-14 * * test $(date +\%u) -eq 6 && echo "2nd Saturday"
Nel tuo caso dovrebbe essere
5 7 15-21 * * test $(date +\%u) -eq 7 && echo "3rd Sunday"
P.S. è scritto anche nel link che hai usato tu
https://it.wikipedia.org/wiki/Crontab#Un_errore_comune :P
[1] man 5 crontab
--
Kind regards,
Marco Romano.
Reply to:
- References:
- crontab
- From: Piviul <piviul@riminilug.it>
- Re: crontab
- From: Luca Sighinolfi <lsighinolfi@autistici.org>
- Re: crontab
- From: Luca Sighinolfi <lsighinolfi@autistici.org>
- Re: crontab
- From: Piviul <piviul@riminilug.it>