Actualiser automated_shutdown/read.md
This commit is contained in:
@@ -7,7 +7,7 @@ Crée un fichier /etc/systemd/system/eth-monitor.service :
|
||||
|
||||
Colle ce contenu :
|
||||
|
||||
[Unit]
|
||||
<code>[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</code>
|
||||
|
||||
|
||||
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]
|
||||
<code>[Unit]
|
||||
Description=Timer for Ethernet Connection Monitor
|
||||
|
||||
[Timer]
|
||||
@@ -38,17 +38,17 @@ OnUnitActiveSec=1min
|
||||
AccuracySec=1s
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
WantedBy=timers.target</code>
|
||||
|
||||
|
||||
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
|
||||
<code>sudo nano /etc/systemd/system/shutdown-on-eth-fail.service</code>
|
||||
|
||||
Colle ce contenu :
|
||||
|
||||
[Unit]
|
||||
<code>[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</code>
|
||||
|
||||
|
||||
e. Activer et démarrer les services
|
||||
|
||||
Reference in New Issue
Block a user