Last active
April 22, 2020 22:57
-
-
Save imom39a/5efbdc1e7cd30c21bbdf52da8e0372ea to your computer and use it in GitHub Desktop.
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
## | |
# sudo chmod 775 /usr/local/bin/checkwifi.sh | |
# crontab -e | |
# */5 * * * * /usr/bin/sudo -H /usr/local/bin/checkwifi.sh >> /dev/null 2>&1 | |
## | |
## reboot on network failure | |
ping -c4 192.168.1.1 > /dev/null | |
if [ $? != 0 ] | |
then | |
sudo /sbin/shutdown -r now | |
fi | |
## restart network on network failure | |
ping -c4 192.168.1.1 > /dev/null | |
if [ $? != 0 ] | |
then | |
echo "No network connection, restarting wlan0" | |
/sbin/ifdown 'wlan0' | |
sleep 5 | |
/sbin/ifup --force 'wlan0' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment