serverping.sh: check only the server host and fix the up/down test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-10
@@ -5,17 +5,8 @@
|
|||||||
|
|
||||||
SERVER_IP="192.168.1.19"
|
SERVER_IP="192.168.1.19"
|
||||||
echo -e "Testing Connection...\n\n"
|
echo -e "Testing Connection...\n\n"
|
||||||
nmap -sP 192.168.1.1/24 > /tmp/addresses.txt
|
|
||||||
|
|
||||||
|
if ! nmap -sn "${SERVER_IP}" | grep -q "Host is up";then
|
||||||
#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"
|
echo -e "\nThe server is down\n"
|
||||||
notify-send "Server offline"
|
notify-send "Server offline"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user