Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Ping an IP address repeatedly and give a synthesized voice alert when the ping is successful or times out.

PingCheck can be used with Terminal Notifier for OSX
https://github.com/julienXX/terminal-notifier

## Author

Brian Torres-Gil
Expand Down
18 changes: 14 additions & 4 deletions pingcheck
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ while [ $count -ne 0 ]; do
done

if [ $rc -eq 0 ] ; then # Make final determination.
echo "Ping successfull after ${attempts} attempts."
echo `say Ping successfull after ${attempts} attempts.`
message="Ping successfull after ${attempts} attempts."
echo "$message"
if hash terminal-notifier 2>/dev/null; then
terminal-notifier -title "Ping Check" -subtitle "Success" -message "$message" -sound default
else
echo `say Ping successfull after ${attempts} attempts.`
fi
else
echo "Timeout after ${attempts} attempts."
echo `say Timeout after ${attempts} attempts.`
message="Timeout after ${attempts} attempts."
echo "$message"
if hash terminal-notifier 2>/dev/null; then
terminal-notifier -title "Ping Check" -subtitle "Timeout" -message "$message" -sound default
else
echo `say Timeout after ${attempts} attempts.`
fi
fi