Actualiser automated_shutdown/check_eth.sh
This commit is contained in:
17
automated_shutdown/check_eth.sh
Normal file
17
automated_shutdown/check_eth.sh
Normal 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user