Created
January 1, 2015 07:07
-
-
Save rezkam/0fd190dfcfb36570b6ba to your computer and use it in GitHub Desktop.
Ping test and notify for OS X
This file contains hidden or 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
#!/usr/bin/env bash | |
# you need to install terminal-notifier with $ brew install terminal-notifier | |
while [ "true" ] | |
do | |
count=$(ping -c 4 4.2.2.4 | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') | |
if [ $count -eq 4 ]; then | |
echo "Test pass!" | |
else | |
echo "Test Faild" | |
(terminal-notifier -message "Ghat shode!") | |
fi | |
sleep 10 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment