Shell script to ping multiple hosts

Script to ping multiple host .

first step follows

create a .txt file with hostnames

for example

ping.txt
hostname1 or ip
hostname2 or ip

copy below script into a file and name it as hostping.sh

#!/bin/bash
#
#author : admin@smartproteam.com
#copy rights@smartproteam 2009
#script to ping multiple hosts

#for loop
for i in cat `cat ~/ping.txt`
do
fping $i | grep unreachable
done

Now change the permissions of the script file to all excutable

chmod +x hostping.sh

then run it as

$./hostping.sh

Related Posts with Thumbnails

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comment moderation is enabled. Your comment may take some time to appear.