Skip to content

Instantly share code, notes, and snippets.

@introom
Created April 2, 2016 15:24
Show Gist options
  • Save introom/5760973b7558d1a297a942b0be7563db to your computer and use it in GitHub Desktop.
Save introom/5760973b7558d1a297a942b0be7563db to your computer and use it in GitHub Desktop.
checknet
#!/usr/bin/env bash
trap "exit" INT
while true; do
ping -t 2 google.com >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
osascript -e 'tell app "System Events" to display dialog "你网又断了"' >/dev/null 2>&1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment