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.|
|if [ $(networksetup -getinfo Wi-Fi | grep -c 'IP address:') = '1' ]|
|$(networksetup -setairportpower en1 off)|
|$(networksetup -setairportpower en1 on)|
|echo "Restarting Wi-Fi at $(date)."|