Crontab ne marche pas

Fermé
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 - 19 nov. 2009 à 10:08
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 - 20 nov. 2009 à 11:03
Bonjour à tous et à toutes

Voici mon probleme j'essai de configurer un crontab exécutant mon script arret_pc.sh voici comment je proccède :

administrateur@pc-med300709b:~$ sudo -s
root@pc-med300709b:~# crontab -e
no crontab for root - using an empty one
29
1
# m h dom mon dow command
59 23 * * * /home/administrateur/Bureau/arret_pc.sh
?
59 23 * * * /home/administrateur/Bureau/arret_pc.sh >> /tmp/log.txt
?

J'arrive pas a compredre pourquoi ma configuration n'est pas prise en compte ???

Si vous avez des idées.....


Merci d'avance
A voir également:

24 réponses

Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 11:10
Voici ce qu'il me donne :

root 1140 1 0 11:21 ? 00:00:00 cron
root 2122 2102 0 13:07 pts/0 00:00:00 grep cron
1
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 15:40
Ouais voila ce que j'ai fait et tjs rien fanchement je sais pas quoi faire :

root@pc-med300709b:~# service cron stop
cron stop/waiting
root@pc-med300709b:~# service cron start
cron start/running, process 2289
root@pc-med300709b:~# crontab -e
no crontab for root - using an empty one
29
1
# m h dom mon dow command
50 15 * * * /sbin/shutdown -h 0 >> /tmp/log.txt
?
1
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 4 895
19 nov. 2009 à 10:30
Salut,

Ton script est exécutable au moins ?
Il y a quoi dedans ?
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 10:40
Oui le script est exécutable si je le lance a la main sa fonctionne.

Je te donne son contenu :

#!/bin/sh

sudo shutdown -h 0

Merci de ton aide

Cdt


Tony
0

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

Posez votre question
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 4 895
19 nov. 2009 à 10:42
Euh... dans la mesure où la crontab est exécutée par le pseudo "root", enlever le "sudo" et rajouter le chemin complet vers "shutdown" (/sbin/shutdown).
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 10:54
Ok j'ai docn essayer de faire ceci et encore pareil je commence a déséspéré :(

Voici ce que j'ai essayer de faire :

administrateur@pc-med300709b:~$ sudo -s
root@pc-med300709b:~# crontab -e
no crontab for root - using an empty one
29
1
# m h dom mon dow command
00 11 * * * root /sbin/shutdown -h 0
?
00 11 * * * root /sbin/shutdown -h 0
?
00 11 * * * /sbin/shutdown -h 0
?
00 11 * * * root /sbin/shutdown -h 0 >> /tmp/log.txt
?

Sa ne marche encore pas
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 10:55
hello
cron tourne ?
ps -ef¦grep cron
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 12:03
teste le cron avec une ligne
* * * * * date >> /tmp/testcron.log
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 13:10
tjs pareil cela ne fonctionne pas !!!

Je commence a déséspéré vosu connaissez un autre moyen sinon pour programmer un arret quotidien
à 23h59 ???

Merci de votre aide
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 14:11
affiche
crontab -l
cron ne fonctionne pas, essaye de le redémarrer
/etc/init.d/cron stop
/etc/init.d/cron start
/etc/init.d/cron status
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 14:32
J'ai donc essayé les 3 commandes est j'ai comme résultat :

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cron status

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the status(8) utility, e.g. status cron
cron start/running, process 2245
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 14:41
essaye
service cron stop
service cron start
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 15:45
que répond crontab -l
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 16:26
Il me repond aucun crontab de crée !!
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 16:34
quand tu edites avec crontab -e tu ne sauve pas en sortant, quel editeur utilises tu ?
ou bien essaye:
echo '* * * * * date >> /tmp/log1' ¦ crontab -
crontab -l
tail -f /tmp/log1
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
19 nov. 2009 à 17:25
Question peut etre bete mais pour moi quand je fini d'écrire ma ligne j'appuie sur entrée et après sa me met jsute :
?

Cela devrai dire que quand jappuie sur entrée il l'enregistre pas

Quelle command utiliser pour qu'il enregistre alors ma commande ????
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
19 nov. 2009 à 18:13
si c'est ed taper
w
q
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
20 nov. 2009 à 10:08
Salut désolé j'ai pas pu le fare hier voial ce que sa me donne :

root@pc-med300709b:~# crontab -e
no crontab for root - using an empty one
29
1
# m h dom mon dow command
15 10 * * * /sbin/shutdown -h 0
?
w
29
q
crontab: "/usr/bin/sensible-editor" exited with status 1
root@pc-med300709b:~# crontab -l
no crontab for root

J'arrve pas a comprendre
0
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
20 nov. 2009 à 10:13
quel éditeur texte utilises-tu habituellement ? tu fais par ex. pour que crontab ouvre vi :
export EDITOR=/usr/bin/vi
crontab -e
0
Tony85 Messages postés 72 Date d'inscription lundi 13 octobre 2008 Statut Membre Dernière intervention 2 août 2011 7
20 nov. 2009 à 10:24
Non pour réaliser sa je lanec mon terminal et tape crontab -e
0