Last active
May 2, 2016 17:02
-
-
Save hermes-pimentel/5269ce41bf57915d87f8ad4c14fc60c3 to your computer and use it in GitHub Desktop.
dd-wrt reset wan IP if internet isn't working
This file contains hidden or 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
#!/bin/bash | |
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo `date` " - Internet OK - IP:" `ifconfig vlan2 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'` >> /tmp/script.out | |
exit 0 | |
else | |
echo `date` " - Internet NOK - IP:" `ifconfig vlan2 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'` >> /tmp/script.out | |
killall -SIGUSR1 udhcpc | |
killall -SIGUSR2 udhcpc | |
sleep 600 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment