diff --git a/automated_shutdown/read.md b/automated_shutdown/read.md index 0d100f6..9f50ec1 100644 --- a/automated_shutdown/read.md +++ b/automated_shutdown/read.md @@ -7,7 +7,7 @@ Crée un fichier /etc/systemd/system/eth-monitor.service : Colle ce contenu : -[Unit] +[Unit] Description=Ethernet Connection Monitor After=network.target @@ -19,7 +19,7 @@ RestartSec=60 TimeoutStopSec=5 [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target c. Créer le timer systemd pour déclencher l’extinction @@ -29,7 +29,7 @@ Crée un fichier /etc/systemd/system/eth-monitor.timer : Colle ce contenu : -[Unit] +[Unit] Description=Timer for Ethernet Connection Monitor [Timer] @@ -38,17 +38,17 @@ OnUnitActiveSec=1min AccuracySec=1s [Install] -WantedBy=timers.target +WantedBy=timers.target d. Créer un service pour éteindre après 5 minutes de panne Crée un fichier /etc/systemd/system/shutdown-on-eth-fail.service : -sudo nano /etc/systemd/system/shutdown-on-eth-fail.service +sudo nano /etc/systemd/system/shutdown-on-eth-fail.service Colle ce contenu : -[Unit] +[Unit] Description=Shutdown on Ethernet Failure After=eth-monitor.service @@ -57,7 +57,7 @@ Type=oneshot ExecStart=/bin/sh -c 'if [ $(journalctl -u eth-monitor.service --since "5 minutes ago" | grep -c "is down") -ge 5 ]; then /sbin/shutdown -h now; fi' [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target e. Activer et démarrer les services