Added: serverping.sh
This commit is contained in:
parent
023f489954
commit
334595c84e
24
serverping.sh
Normal file
24
serverping.sh
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user