Tache cron ne s'execute pas [ Mandriva ]

Fermé
fredericb - 5 déc. 2007 à 17:45
fredob Messages postés 14 Date d'inscription mercredi 5 décembre 2007 Statut Membre Dernière intervention 4 mars 2010 - 5 déc. 2007 à 18:57
Bonjour,

Mon problème :

Je configure une tache cron en tant que root, cette tache se lance au moment demandé mais le fichier .sh ne s'execute pas.

Ma configuration:

Le fichier .sh à lancer est '/etc/BackupMysql.sh'
Ce fichier fonctionne en tappant" [root@SRV001 ~]# /etc/BackupMysql"
Je mets les droits full pour le test sur ce fichier.
chmod 7777 /etc/BackupMysql.sh

Je lance la commande en root :
crontab -e

J'introduit et je sauvegarde :
25 17 5 12 3 /etc/BackupMysql.sh

Je relance le processus cron :
/etc/init.d/cron stop
/etc/init.d/cron start



La tache se lance:
Dec 5 17:25:01 SRV001 crond[15103]: (root) CMD (root /etc/BackupMysql.sh)

Il n'y a rien qui se passe par la suite.

Le fichier '/etc/crontab' contient :

[root@SRV001 ~]# tail -f /etc/crontab
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO="xxx"
HOME=/

# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly

6 réponses

marc[i1] Messages postés 2573 Date d'inscription vendredi 1 avril 2005 Statut Contributeur Dernière intervention 6 septembre 2008 382
5 déc. 2007 à 17:59
Salut,

place ton script dans /etc/cron.daily/
ça devrait mieux fonctionner :)
0
Merci pour ta réponse.

Par la suite, j'aimerai mettre :
00 */12 * * * /etc/BackupMysql.sh

Il faut que je le mette quelque part de special ?
0
marc[i1] Messages postés 2573 Date d'inscription vendredi 1 avril 2005 Statut Contributeur Dernière intervention 6 septembre 2008 382
5 déc. 2007 à 18:21
humm

en fait une tache cron 'simple' se décompose comme suis :
- un script bash situé dans /etc/cron.{hourly,daily,...}
tache.cron
> #!/bin/sh
> echo "plop"


- on rends exécutable le script :
chmod 755 tache.cron


Maintenant ton script va se lancer en même temps que les autres taches cron.
0
Oui je vois ce que tu veux dire.

Il est pas possible de creer une tache cron personnalisée en utilisant pas les dossion cron.daily,... ?
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
je peux peut etre ajouter dans le /etc/contrab :

00 */12 * * * root nice -n 19 run-parts --report /etc/cron.personnel

Ce qui donnera :


[root@SRV001 ~]# tail -f /etc/crontab
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO="xxx"
HOME=/

# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly
00 */12 * * * root nice -n 19 run-parts --report /etc/cron.personnel
0
fredob Messages postés 14 Date d'inscription mercredi 5 décembre 2007 Statut Membre Dernière intervention 4 mars 2010
5 déc. 2007 à 18:57
je suis fredericb j'ai ouvert un compte.

je peux peut etre ajouter dans le /etc/contrab :

00 */12 * * * root nice -n 19 run-parts --report /etc/cron.personnel

Ce qui donnera :


[root@SRV001 ~]# tail -f /etc/crontab
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO="xxx"
HOME=/

# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly
00 */12 * * * root nice -n 19 run-parts --report /etc/cron.personnel

je mets alors le fichier 'BackupMysql' dans 'cron.personnel'. et tout fonctionne !
0