18 lines
404 B
Bash
18 lines
404 B
Bash
## 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
|
|
|
|
|