Richard Bruno
navigation
Home
admin









Crontab
October 18th, 2016

Vous souhaitez configurer votre crontab de telle sorte qu'un programme s'exécute le premier lundi de chaque mois ?
Et vous imaginez qqch comme ça :

15 13 1-7 * 1 root /root/monscript



Et bien non ! ca ne fonctionne pas !

Extrait :


>it is impossible to set up a job to run "every
> Friday between the 5th and the 15th".
>
> Plus the current behaviour is a bit inconsistent. The other fields are
> combined with a logical AND (ie: month AND day of month AND hour AND
> minute), whereas the day of month and day of week fields are combined
> with a logical OR.
But it's probably standard, documented behavior since 1970 so not
reasonable/possible to change.



Source : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=460070

Une solution :

15 13 1-7 * * root [ $(/bin/date "+\%w") -eq 1 ] && /root/monscript



à l'antislash (\) devant le %


Dernières modifs
Systemd (October 24th, 2020)
TP - rsyslogd (June 20th, 2017)
Gestion de la memoire (June 20th, 2017)
Ansible (November 10th, 2016)
Fichiers et systèmes de fichiers (November 8th, 2016)
X (October 20th, 2016)
Obtenir des informations sur le système (October 19th, 2016)

Contact
Pour m'envoyer un mail,
Pour me laisser un commentaire :
richard.brunooo
chez
gmail.com


powered by kure, modified by Bruno