Actualiser automated_shutdown/setup.md
This commit is contained in:
@@ -7,7 +7,7 @@ Crée un fichier /etc/systemd/system/eth-monitor.service :
|
|||||||
|
|
||||||
Colle ce contenu :
|
Colle ce contenu :
|
||||||
|
|
||||||
[Unit]
|
<pre><code>[Unit]
|
||||||
Description=Ethernet Connection Monitor
|
Description=Ethernet Connection Monitor
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ TimeoutStopSec=5
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
c. Créer le timer systemd pour déclencher l’extinction
|
c. Créer le timer systemd pour déclencher l’extinction
|
||||||
@@ -29,7 +30,7 @@ Crée un fichier /etc/systemd/system/eth-monitor.timer :
|
|||||||
|
|
||||||
Colle ce contenu :
|
Colle ce contenu :
|
||||||
|
|
||||||
[Unit]
|
<pre><code>[Unit]
|
||||||
Description=Timer for Ethernet Connection Monitor
|
Description=Timer for Ethernet Connection Monitor
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
@@ -39,7 +40,7 @@ AccuracySec=1s
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
d. Créer un service pour éteindre après 5 minutes de panne
|
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 :
|
Crée un fichier /etc/systemd/system/shutdown-on-eth-fail.service :
|
||||||
@@ -48,7 +49,7 @@ Crée un fichier /etc/systemd/system/shutdown-on-eth-fail.service :
|
|||||||
|
|
||||||
Colle ce contenu :
|
Colle ce contenu :
|
||||||
|
|
||||||
[Unit]
|
<pre><code>[Unit]
|
||||||
Description=Shutdown on Ethernet Failure
|
Description=Shutdown on Ethernet Failure
|
||||||
After=eth-monitor.service
|
After=eth-monitor.service
|
||||||
|
|
||||||
@@ -58,16 +59,17 @@ ExecStart=/bin/sh -c 'if [ $(journalctl -u eth-monitor.service --since "5 minute
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
e. Activer et démarrer les services
|
e. Activer et démarrer les services
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
<pre><code>sudo systemctl daemon-reload
|
||||||
sudo systemctl enable eth-monitor.service
|
sudo systemctl enable eth-monitor.service
|
||||||
sudo systemctl enable eth-monitor.timer
|
sudo systemctl enable eth-monitor.timer
|
||||||
sudo systemctl enable shutdown-on-eth-fail.service
|
sudo systemctl enable shutdown-on-eth-fail.service
|
||||||
sudo systemctl start eth-monitor.timer
|
sudo systemctl start eth-monitor.timer
|
||||||
sudo systemctl start eth-monitor.service
|
sudo systemctl start eth-monitor.service
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
2. Vérifier le bon fonctionnement
|
2. Vérifier le bon fonctionnement
|
||||||
@@ -75,7 +77,7 @@ sudo systemctl start eth-monitor.service
|
|||||||
Consulte les logs :
|
Consulte les logs :
|
||||||
|
|
||||||
|
|
||||||
journalctl -u eth-monitor.service -f
|
<code>journalctl -u eth-monitor.service -f</code>
|
||||||
|
|
||||||
|
|
||||||
Teste en débranchant le câble Ethernet et attends 5 minutes.
|
Teste en débranchant le câble Ethernet et attends 5 minutes.
|
||||||
|
|||||||
Reference in New Issue
Block a user