Skip to content

Instantly share code, notes, and snippets.

@rezkam
Created January 1, 2015 07:07
Show Gist options
  • Save rezkam/0fd190dfcfb36570b6ba to your computer and use it in GitHub Desktop.
Save rezkam/0fd190dfcfb36570b6ba to your computer and use it in GitHub Desktop.
Ping test and notify for OS X
#!/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