Last active
January 4, 2021 08:54
-
-
Save clifton/7575a9f2a1c64541561bb0e0704c39eb to your computer and use it in GitHub Desktop.
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 | |
# sudo crontab -e | |
# insert at top of crontab: SHELL=/bin/bash | |
# */1 * * * * /bin/check-net >> /var/log/check-net.log 2>&1 | |
if ! (/usr/bin/dig +short myip.opendns.com @resolver1.opendns.com > /dev/null) ; then | |
echo $(date) - check-net failed. restarting... | |
killall wpa_supplicant | |
sleep 2 | |
/usr/sbin/netplan apply | |
else | |
echo $(date) - internet looks OK | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment