diff --git a/automated_shutdown/read.md b/automated_shutdown/read.md index 4fd0dec..3a5a53c 100644 --- a/automated_shutdown/read.md +++ b/automated_shutdown/read.md @@ -7,23 +7,20 @@ Crée un fichier /etc/systemd/system/eth-monitor.service : Colle ce contenu : - [Unit] Description=Ethernet Connection Monitor After=network.target - - + [Service] Type=simple ExecStart=/usr/local/bin/check_eth_connection.sh Restart=on-failure RestartSec=60 TimeoutStopSec=5 - - + [Install] WantedBy=multi-user.target - + c. Créer le timer systemd pour déclencher l’extinction Crée un fichier /etc/systemd/system/eth-monitor.timer : @@ -32,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] @@ -41,7 +38,7 @@ OnUnitActiveSec=1min AccuracySec=1s [Install] -WantedBy=timers.target +WantedBy=timers.target d. Créer un service pour éteindre après 5 minutes de panne @@ -51,7 +48,7 @@ Crée un fichier /etc/systemd/system/shutdown-on-eth-fail.service : Colle ce contenu : -[Unit] +[Unit] Description=Shutdown on Ethernet Failure After=eth-monitor.service @@ -60,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