{{tag>Brouillon SystemD}}
= Systemd lancer un script à l'arrêt
Source : http://unix.stackexchange.com/questions/39226/how-to-run-a-script-with-systemd-right-before-shutdown
''/etc/systemd/system/jbshutdown.service''
[Unit]
Description=Exec before shutdown
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/root/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
chmod +x /root/bin/shutdown.sh
systemctl enable jbshutdown.service
systemctl start jbshutdown.service
Le lien symbolique suivant sera crée :
''/etc/systemd/system/multi-user.target.wants/jbshutdown.service''