Here is the sample script to find out which host is up and which one is down
#!/bin/bash
#Author: Vijay Kumar
#Date: 10.04.2013
#Purpose: Write a shell script to check network status
for (( i=1; i <=50; i++))
do
ping 192.168.1.$i -c 1 -i 3 &>/dev/null
if [ $? -eq 0]
then
echo "Host 192.168.1.$i is up"
else
echo "Host 192.168.1.$i is down"
fi
done
#END
#!/bin/bash
#Author: Vijay Kumar
#Date: 10.04.2013
#Purpose: Write a shell script to check network status
for (( i=1; i <=50; i++))
do
ping 192.168.1.$i -c 1 -i 3 &>/dev/null
if [ $? -eq 0]
then
echo "Host 192.168.1.$i is up"
else
echo "Host 192.168.1.$i is down"
fi
done
#END
No comments:
Post a Comment