Put the list of ip’s in file
mohammedrafi@NOC-RAFI:~$ vim ips
10.12.13.14
172.15.48.3
192.168.45.54
48.114.78.227
192.168.0.1
192.168.0.2
192.168.0.5
Write the script and place the path of ip’s file
mohammedrafi@NOC-RAFI:~$ vim script.sh
#!/bin/bash
# Program name: pingall.sh
date
cat /home/mohammedrafi/ips | while read output
do
ping -c 1 “$output” > /dev/null
if [ $? -eq 0 ]; then
echo “node $output is up”
else
echo “node $output is down”
fi
done
run the script
mohammedrafi@NOC-RAFI:~$ sh script.sh
Fri Aug 19 17:03:45 IST 2016
node 10.12.13.14 is down
node 172.15.48.3 is down
node 192.168.45.54 is down
node 48.114.78.227 is down
node 192.168.0.1 is up
node 192.168.0.2 is down
node 192.168.0.5 is up
