The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-17-2008
era
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
I think I saw a program called "uping" or "mping" which had more fine-grained timing controls (I think part of the MRTG suite ... could have been "fastping" too).

Two other ideas come to mind.

1. Run asynchronously. Spawn off a big bunch of pings and even if some of them take one second or more, the whole bunch will finish in one or two seconds (provided you have the CPU and bandwidth to run enough of them in parallel).


Code:
subnet=192.168.2.
for addr in `seq 1 1 255 `; do
  ( ping -c 1 -t 1 $subnet$addr > /dev/null && echo Found $subnet$addr ) &
done

2. Is ping really what you want? If you have a hunch about a port you could expect to be open, netcat could do this much faster (and probably produce more accurate results -- the fact that ping works doesn't really mean the host is up and working correctly).