2010-09-08 14 views

Répondre

20

question originale a été taguée cron donc cette première section s'applique à cela. Voir ci-dessous pour une réponse mise à jour pour l'outil Quartz CronTrigger.


La plupart des crontabs ne vous laissez pas vous préciser l'année donc probablement à le mettre dans le script lui-même (ou un emballage autour du script/programme).

Vous pouvez le faire avec quelque chose comme:

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

L'option que vous cherchez à courir à 6h du matin le 6 Septembre chaque année

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). 

Pour la Quartz CronTrigger format, vous seriez à la recherche de quelque chose comme:

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). 

(détails recueillis auprès de here).

+0

peut-il expliquer à chaque champ –

+0

Il y a go, @ Débutant. – paxdiablo

+0

de http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html nous devons également mentionner heure, minute et seconde –

1

Il pourrait être que dans/etc/crontab en suit:

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