Advertisements
First we have to set a variable status and an IP to check.
See the example given below :
#!/bin/bash
#Purpose : TO check whether a system is up and working or not using a simple ping check.
IP=192.168.0.21
status=1
until [ "$status" -eq "0" ]
do
ping -c 1 $IP > /dev/null
status=`echo $?`
if [ "$status" = "1" ]
then
echo "The machine $IP seems to be down!"
else
echo "The machine $IP is up"
fi
done
No comments:
Post a Comment
Be nice. That's all.