Ajouter check_eth.sh

This commit is contained in:
2026-01-11 12:48:00 +00:00
parent c7fdae428e
commit 4fa4bbf8a1

17
check_eth.sh Normal file
View File

@@ -0,0 +1,17 @@
## nano /root/check_eth.sh && chmod +x /root/check_eth.sh
#!/bin/bash
INTERFACE="eth0"
TIMEOUT=300 # 5 minutes en secondes
if ! ifconfig $INTERFACE | grep -q "inet " ; then
echo "Ethernet down, checking for $((TIMEOUT/60)) minutes..."
sleep $TIMEOUT
if ! ifconfig $INTERFACE | grep -q "inet " ; then
echo "Ethernet still down, shutting down..."
shutdown -h now
fi
fi