Skip to content

Instantly share code, notes, and snippets.

@alexlovelltroy
Created February 7, 2014 22:37
Show Gist options
  • Save alexlovelltroy/8873455 to your computer and use it in GitHub Desktop.
Save alexlovelltroy/8873455 to your computer and use it in GitHub Desktop.
An expanded bash oneliner to use on a mac and notify you when the internet comes back
INTERNET=1 # We have internet access
while 1 ; do
export OLD_INTERNET=$INTERNET;
sleep 5 && dig vpn.activision.com +short && export INTERNET=1 || export INTERNET=0;
if [ $OLD_INTERNET -lt $INTERNET ]; then
say "We have internet";
fi;
if [ $OLD_INTERNET -gt $INTERNET ]; then
say "We lost internet";
fi;
echo "`date` WAS $OLD_INTERNET AND IS $INTERNET"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment