Skip to content

Instantly share code, notes, and snippets.

@yalab
Created January 4, 2016 05:47
Show Gist options
  • Save yalab/ff33a923305279d31759 to your computer and use it in GitHub Desktop.
Save yalab/ff33a923305279d31759 to your computer and use it in GitHub Desktop.
#!/bin/bash
COUNT="3"
HOST="google.com"
PING="/sbin/ping"
while true ;do
$PING -c $COUNT $HOST > /dev/null
if [ "$?" = "68" ];then
networksetup -setairportpower en0 on
elif [ "$?" != "0" ];then
networksetup -setairportpower en0 off && networksetup -setairportpower en0 on
fi
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment