Created
February 11, 2015 21:33
-
-
Save navhaxs/8029bea3420cdbb11047 to your computer and use it in GitHub Desktop.
openwrt wan auto reconnect hotplug script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place me in /etc/hotplug.d/iface/99-keepwanalive | |
if [ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ]; then | |
COUNTER=0 | |
PASS=0 | |
while [ $PASS -eq 0 ] | |
do | |
grep "up" /sys/class/net/eth0/operstate > /dev/null | |
if [ $? != "up" ]; then | |
let COUNTER++ | |
logger -t DEBUG "Attempt #${COUNTER} to reconnect wan" | |
ifup wan | |
sleep 15 #sec | |
else | |
PASS=1 | |
fi | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe just set once "ifup wan" without while loop and all other things...