From a0361d89cba691655c96614eaef98e7c842ca999 Mon Sep 17 00:00:00 2001 From: Paul Nguyen Date: Thu, 10 Mar 2016 12:06:01 -0800 Subject: [PATCH 1/2] adding terminal notifier integration --- pingcheck | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pingcheck b/pingcheck index 8d1da4d..4d4d1ba 100755 --- a/pingcheck +++ b/pingcheck @@ -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 From dfcc7258b145ef4b6dfb00b27703943192b556ea Mon Sep 17 00:00:00 2001 From: Paul Nguyen Date: Thu, 10 Mar 2016 12:13:06 -0800 Subject: [PATCH 2/2] Update readme to include terminal notifier --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0b4ebe6..37f5b43 100644 --- a/README.md +++ b/README.md @@ -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