Contenu | Rechercher | Menus

Annonce

DVD, clés USB et t-shirts Ubuntu-fr disponibles sur la boutique En Vente Libre

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Aujourd'hui à 17:59

greenhel

crontab -e planninfication d'extinction de l'ordinateur inopérant

Bonjour,

Je souhaite approfondir mes connaissances d'unix mais je reste encore un débutant.

Après avoir fait mes recherches et essayés diverses commandes je n'ai pas connu le succès escompter.

Je souhaite planninfier via crontab -e l'extinction de mon ordinateur. Malheureusement toutes les opérations que j'ai réalisé se sont soldé par un echecs et je n'arrive pas à trouver mon erreur. Pouvez vous m'éclairé ?

La commande shutdown-h now fonctionne.
L['opération à également été réalisé dans une VM.

#1 la classique que j'ai retrouver sur pas mal de sites

30 22 * * * shutdown -h now

#2 en pointant sur sbin

30 22 * * * /usr/sbin/shutdown -h now

#3 en pointant sur sbin mais avec root

30 22 * * * root /usr/sbin/shutdown -h now

#4 en pointant sur sbin mais avec mika

30 22 * * * mika /usr/sbin/shutdown -h now

#5 en pointant sur etc/cron.d mais avec mika

30 22 * * * mika /etc/cron.d/shutdown -h now

#6 en pointant sur etc/cron.d  mais avec root

30 22 * * * root /etc/cron.d/shutdown -h now

#7 en pointant sur etc/cron.d

30 22 * * * /etc/cron.d/shutdown -h now

#8 la dernière comme indiquer ci-après

0 22 * * * root shutdown -h now /usr/sbin/shutdown

#9 la dernière comme indiquer ci-après légèrement modifié

 30 22 * * * root shutdown -h now /usr/sbin/shutdown -h now

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *    root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#


Il y en à pas mal pourtant je n'y suis pas arrivé et je ne comprend pas pourquoi

Merci

Dernière modification par greenhel (Aujourd'hui à 18:14)

Hors ligne