Outils pour utilisateurs

Outils du site


start:raspberry:arret

Ceci est une ancienne révision du document !


Arret Raspberry toute version

Autoriser votre utilisateur

Votre utilisateur doit etre autoriser à lancer une commande avec sudo sans taper de mot de passe pour pouvoir lancer cette commande en automatique dans un fichier crontab

Modifier le fichier /etc/sudoers

  sudo nano /etc/sudoers

avec la ligne à la fin ( si votre utilisateur est pi )

 pi ALL=(ALL) NOPASSWD: /sbin/shutdown -h now
sudoers.txt
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 
# Host alias specification
 
# User alias specification
 
# Cmnd alias specification
 
# User privilege specification
root    ALL=(ALL:ALL) ALL
 
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
 
# See sudoers(5) for more information on "@include" directives:
 
@includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: /sbin/shutdown -h now

editer et modifier un fichier crontab

   crontab  -e     

en ajoutant la ligne ( pour arret à 23h00 chaque jour ) :

  00  23 * * * sudo shutdown -h now
/home/chanteri/www/fablab37110/data/attic/start/raspberry/arret.1707823979.txt.gz · Dernière modification : 2024/02/13 12:32 de gerardadmin