Last active
March 13, 2021 20:27
-
-
Save drewmccormack/78a1e9deb4f592822615 to your computer and use it in GitHub Desktop.
Keeps your OS X WiFi connected to the interwebs.
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
#!/usr/bin/env bash | |
# If your OS X WiFi connection stops working, but can be fixed by | |
# toggling WiFi off and then on, this script can help prevent mouse arm. | |
# Pings Apple's server repeatedly, toggling WiFi off/on when a connection times out. | |
while true ; do | |
curl --head --silent --connect-timeout 10 http://www.apple.com/my-wifi-keeps-dropping-out > /dev/null | |
if [ $? -ne 0 ] ; then | |
networksetup -setairportpower en1 off | |
networksetup -setairportpower en1 on | |
fi | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment