Last active
January 19, 2016 13:25
-
-
Save dmorgantini/31bea10fb6c64cdc38b2 to your computer and use it in GitHub Desktop.
Execute this to ensure that your macbook pro resets the DHCP lease each time your macbook pro decides to drop the wifi connection.
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 | |
FAIL_COUNT=0 | |
TIME=1 | |
while true; do | |
ping -c 1 -t 1 google.com > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Network down - :-(" | |
echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil | |
((FAIL_COUNT=FAIL_COUNT+1)) | |
((TIME=TIME*2)) | |
else | |
echo "Network Up " $FAIL_COUNT | |
TIME=1 | |
fi | |
sleep $TIME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment