Created
February 18, 2015 06:51
-
-
Save ankel/1c38bf38c8a9d0093fb9 to your computer and use it in GitHub Desktop.
Cron job that runs once every 10m and reset wlan0 if no internet connection is detected
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 | |
ping -c 1 google.com > /dev/null & wait $! | |
if [ $? != 0 ]; then | |
echo "$(date) Wifi down, resetting" >> /var/log/wifi.log | |
sudo ifdown wlan0 & wait $! | |
sudo ifup wlan0 & wait $! | |
else echo "$(date) Wifi up" >> /var/log/wifi.log | |
fi | |
# add to crontab | |
# */10 * * * * /home/<USER>/check_con.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment