Created
October 23, 2014 15:05
-
-
Save myrtleTree33/4edbc88b82c31a48d597 to your computer and use it in GitHub Desktop.
Auto reconnect a Raspberry Pi by pinging google. Does ifdown and ifup is connection is down.
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 | |
HOST=google.com | |
while : | |
do | |
if ping -c 1 $HOST &> /dev/null | |
then | |
echo 1 | |
else | |
echo 0 | |
# Restart connection if unavailable | |
sudo ifdown wlan0 && sudo ifup wlan0 | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment