Outils pour utilisateurs

Outils du site


linux:ubuntu:cron

Ceci est une ancienne révision du document !


CRON

Vérifier si le service CRON tourne

sudo systemctl status cron

S'il faut l'installer :

sudo apt install cron

Configuration de CRON

Éditer le fichier /etc/crontab

sudo vi /etc/crontab
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

Dans /etc/crontab, le service est déjà configuré pour lancer les scripts se trouvant dans les sous-dossiers :

chaque jour à 6:00 /etc/cron.daily
chaque semaine le dimanche à 6:00 /etc/cron.weekly
chaque mois le 1er /etc/cron.monthly
linux/ubuntu/cron.1590903518.txt.gz · Dernière modification: 2020/05/31 05:38 par marclebrun