Différence entre le crontab de root et /etc/cron ?
11 réponses
mpg
Bonjour,
Je suis pas bien sûr de savoir si ma question est commune à tous les Unix,
ou spécifique à Linux, peut-être même est-ce une pure Debiannerie. Bref,
pluriplublication fcolc et fcou, suivi fcolc au hasard.
Bon, alors j'aimerais bien automatiser certaines tâches sur ma machine qui
ont besoin d'être répétées à intervalle réguliers. Ces tâches sont à
effectuer en root. J'ai lu[1] man crontab(1) puis essayé de modifier la
crontab de root. Je me suis alors aperçu qu'elle était vide.
Ça m'a un rien surpris, vu qu'il y a quand même forcément des tâches
chroniques exécutées en root. Bref, je suis allé voir dans /etc/ et il y a
effectivement des sous-répertoires cron.daily à cron.monthly qui
contiennent des scripts.
Du coup, ma question est la suivante : quelle est la différence entre placer
un appel à script dans la crontab de root, et placer ledit script dans,
mettons, /etc/cron.weekly ?
Merci d'avance pour vos avis,
Manuel.
[1] par contre j'ai cherché en vain la page qui décrit la syntaxe du fichier
de crontab : j'ai fini par essayer au hasard à partir d'exemples vus ça et
là, ça a l'air de marcher, mais bon...
bravo maintenant que tu as vu que c est different pourquoi tu ne vas pas jusqu'au bout ?
man 5 contab :
Several environment variables are set up automatically by the cron(8) daemon. SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. PATH is set to "/ usr/bin:/bin". HOME, SHELL, and PATH may be overridden by settings in the crontab; LOGNAME is the user that the job is running from, and may not be changed.
On Sat, 24 Nov 2007 10:28:09 +0100, GuiGui wrote:
je te propose un test.
bravo maintenant que tu as vu que c est different pourquoi tu ne vas pas
jusqu'au bout ?
man 5 contab :
Several environment variables are set up automatically by the cron(8)
daemon. SHELL is set to /bin/sh, and LOGNAME and HOME are
set from the /etc/passwd line of the crontab's owner. PATH is set to "/
usr/bin:/bin". HOME, SHELL, and PATH may be overridden by settings in
the crontab; LOGNAME is the user that the job is running from, and may
not be changed.
bravo maintenant que tu as vu que c est different pourquoi tu ne vas pas jusqu'au bout ?
man 5 contab :
Several environment variables are set up automatically by the cron(8) daemon. SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. PATH is set to "/ usr/bin:/bin". HOME, SHELL, and PATH may be overridden by settings in the crontab; LOGNAME is the user that the job is running from, and may not be changed.