Last active
December 16, 2015 19:00
-
-
Save drkmullins/5482398 to your computer and use it in GitHub Desktop.
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.
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 | |
# Checks my mac's Wi-Fi every 5 seconds. | |
# If it's down, restart the adapter. | |
while : | |
do | |
if [ $(networksetup -getinfo Wi-Fi | grep -c 'IP address:') = '1' ] | |
then | |
$(networksetup -setairportpower en1 off) | |
$(networksetup -setairportpower en1 on) | |
sleep 5 | |
echo "Restarting Wi-Fi at $(date)." | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment