Skip to content

Instantly share code, notes, and snippets.

@dmorgantini
Last active January 19, 2016 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmorgantini/31bea10fb6c64cdc38b2 to your computer and use it in GitHub Desktop.
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.
#!/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