Re: ping

Anthony J Placilla <[email protected]> Wed, 29 Sep 2004 13:28:19 -0400
Newsgroups gmane.linux.redhat.release.valhalla
Message-ID <[email protected]>
On Wed, 2004-09-29 at 12:46, Harry Hambi wrote:
> Hi,
> Is there a way of creating a file containing multiple ip
> addresses….then using one ping command get each ip In the file to
> respond.I have about 20 ip's to check for a response.
> 
> Rgds.
> 
> Harry.
> 


create a colon separated list of IP addresses you need to ping & then do
something like:

#!/bin/bash
INLINE=listing.csv
   n=1           # server number

    for name in $(awk 'BEGIN{FS=":"}{print $1}' < "$INLINE" )
   
   do
     ping -c 1 -w 1 "$name"
     let "n += 1"
   done


   exit 0


redirect the output to  a file if you need it to save for later perusal

-- 
Tony Placilla, RHCT
[email protected]
J.O.A.T.

perl -e 'print $i=pack(c5, (41*2), sqrt(7056), (unpack(c,H)-2), oct(115), 10);'