script or other suggestion

Cameron Simpson cs at zip.com.au
Thu Nov 22 21:09:45 UTC 2007


On 22Nov2007 15:35, chloe K <chloekcy2000 at yahoo.ca> wrote:
| I have ip list in my network
| I need to check which ip is unused
| what is better solution?
| 
| Write the ping script or use other command
| 
| eg: 
| 
| for i in ip.txt
| ping -c 3 $i

That would be:

  for i in `cat ip.txt`
  do  ping -c 3 $i || { echo "IP $i is not in use."; break; }
  done

Of course, if a machine happens to be down/off, if will look
like its IP is not in use...

You could possibly do something clever with nmap or "ping -b",
but your approach is simple and effective.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Getting a SCSI chain working is perfectly simple if you remember that there
must be exactly three terminations: one on one end of the cable, one on the
far end, and the goat, terminated over the SCSI chain with a silver-handled
knife whilst burning *black* candles.   - Anthony DeBoer




More information about the redhat-list mailing list