-
-
Save summer20100514/9e27873f8f0dbd94bd82622df0f3ea2c 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 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