Bonjour tout le monde , en fait je n'arrive pas à savoir pourquoi crontab n'execute pas mon fichier : nouveau_fichier2.py : qui contient le code suivant :
Code :
1 2 3 4 5 6 7 8 9
| #!/usr/bin/python
#-*- coding:Utf-8-*-
# -*- coding: cp1252 -*-
import os
print 'helo'
#raw_input()
os.system("sudo chmod 777 /home/user/Bureau/Test/20111214")
execfile("Backup1.py") |
le fichier nouveau_fichier2.py s'execute bien dans un terminale et fait appelle à l'execution du code du backup : Backup1.py . Laconfiguration de crontab en tappant "crontab -e" est la suivante :
Code :
1 2 3 4 5
| GNU nano 2.2.2 Fichier*: /tmp/crontab.0XMJXm/crontab
# m h dom mon dow command
16 16 14 12 3 python /home/user/Bureau/nouveau_fichier2.py |
et quand je remplace dans la crontab nouveau_fichier2.py par Backup1.py , crontab execute bien Backup1.py a l'heure donné . Et dans le fichier syslog je trouve à cette heure :
Code :
1 2 3 4
| Dec 14 16:16:01 pbadmin-desktop cron[954]: Error: bad hour; while reading /etc/crontab
Dec 14 16:16:01 pbadmin-desktop cron[954]: (openerp_user) ORPHAN (no passwd entry)
Dec 14 16:16:01 pbadmin-desktop cron[954]: (ismail) RELOAD (crontabs/ismail)
Dec 14 16:16:01 pbadmin-desktop CRON[3877]: (ismail) CMD (python /home/ismail/Bureau/nouveau_fichier2.py ) |
Merci bien pour votre aide amis .