Tache cron ne s'execute pas [ Mandriva ]

fredericb -  
fredob Messages postés 15 Statut Membre -
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

  1. marc[i1] Messages postés 2603 Statut Contributeur 382
     
    Salut,

    place ton script dans /etc/cron.daily/
    ça devrait mieux fonctionner :)
    0
  2. fredericb
     
    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
  3. marc[i1] Messages postés 2603 Statut Contributeur 382
     
    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
  4. fredericb
     
    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
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. fredericb
     
    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
  7. fredob Messages postés 15 Statut Membre
     
    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