Skip to content

Instantly share code, notes, and snippets.

@drkmullins drkmullins/
Last active Dec 16, 2015

What would you like to do?
Checks my macbook's Wi-Fi every 5 seconds. If it's down, it restarts the adapter. I use it when my Wi-Fi signal is flaky and my macbook is having issues staying connected.
# Checks my mac's Wi-Fi every 5 seconds.
# If it's down, restart the adapter.
while :
if [ $(networksetup -getinfo Wi-Fi | grep -c 'IP address:') = '1' ]
$(networksetup -setairportpower en1 off)
$(networksetup -setairportpower en1 on)
sleep 5
echo "Restarting Wi-Fi at $(date)."
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.