From 334595c84ecf682fe1c462a18a1275d018baade8 Mon Sep 17 00:00:00 2001 From: mollusk Date: Sun, 19 Nov 2017 08:10:07 -0700 Subject: [PATCH] Added: serverping.sh --- serverping.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 serverping.sh diff --git a/serverping.sh b/serverping.sh new file mode 100644 index 0000000..950c038 --- /dev/null +++ b/serverping.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +#pingcmd="ping -c 1" + +SERVER_IP="192.168.1.19" +echo -e "Testing Connection...\n\n" +nmap -sP 192.168.1.1/24 > /tmp/addresses.txt + + +#grep -Fxq "" + +#${pingcmd} ${SERVER_IP} &>/dev/null + +grepcmd=$(grep -F "${SERVER_IP}" /tmp/addresses.txt) + +echo $grepcmd +if [ ! ${grepcmd} ];then + echo -e "\nThe server is down\n" + notify-send "Server offline" +else + echo -e "\nServer online\n" + notify-send "Server Online" +fi \ No newline at end of file