2010-09-08 13 views

risposta

20

domanda iniziale è stato taggato cron quindi questa prima sezione si applica a questo. Vedi sotto per una risposta aggiornata per lo strumento Quartz CronTrigger.


La maggior parte dei crontabs non consentono di specificare l'anno per cui è probabile che mettere nello script stesso (o un wrapper script/programma).

È possibile farlo con qualcosa di simile:

if [[ $(date +%Y) != 2010 ]] ; then 
    exit 
fi 

L'opzione che stai cercando di correre alle 6 del mattino del 6 settembre ogni anni è

0 6 6 9 * your_command_goes_here 
| | | | | 
| | | | +- any day of the week. 
| | | +--- 9th month (September). 
| | +----- 6th day of the month. 
| +------- 6th hour of the day. 
+--------- Top of the hour (minutes = 0). 

Per la Formato CronTrigger al quarzo, vedresti qualcosa tipo:

0 0 6 6 9 ? 2010 
| | | | | | | 
| | | | | | +- 2010 only. 
| | | | | +----- any day of the week. 
| | | | +------- 9th month (September). 
| | | +--------- 6th day of the month. 
| | +----------- 6th hour of the day. 
| +------------- Top of the hour (minutes = 0). 
+--------------- Top of the minute (seconds = 0). 

(dettagli ottenuti da here).

+0

può spiegare con ogni campo –

+0

Ci ya go, @ Novizio. – paxdiablo

+0

da http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html abbiamo anche bisogno di menzionare ora, minuto e secondo –

1

Non poteva essere che in/etc/crontab dal seguente:

0 6 6 9 * root test `/bin/date +%Y` == 2010 && <your command> 
Problemi correlati