Code Snippet

Just another Code Snippet site

[Cron] How-to

# 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 command to be executed

Exécution tous les jours à 22h00 d’une commande et rediriger les infos dans sauvegarde.log :

00 22 * * * /root/scripts/shell.sh >> sauvegarde.log

Exécution d’une commande toutes les 6 heures :

00 */6 * * * /root/scripts/synchronisation-ftp.sh

Exécution d’une commande toute les heures :

00 */1 * * * /usr/sbin/ntpdate fr.pool.ntp.org

Exécution d’une commande toutes les minutes uniquement les lundis :

* * * * 1 /root/script/commandes-du-lundi.sh

Exécution d’une commande une fois par an à une heure précise (ici le 25 décembre à 00h15) :

15 00 25 12 * echo "Le père Noël est passé !"

Exécuter chaque jour, de chaque mois à 2:15 la commande eix-sync

15 02  * *  * /usr/bin/eix-sync

,


2 thoughts on “[Cron] How-to

Leave a Reply to OLIVIER COMBE Cancel reply

Your email address will not be published. Required fields are marked *