ip ping in bulk batch shell script
Imagine,you've got a task now to verify a bulk of domains the speed of response and whether they are active or not.Here a bulk of,means,for example,1,000.On getting this task,what will you do next?Type in every ip in the command line in Microsoft's cmd and waits for the result?1,000,you must consider it.You may imagine,how tired after you've pinged the full 1,000 of the urls.
Here is my implement of the task.Firstly,put the urls in domain.txt,one url per line.Then run the script:sh if.sh.Lastly,waits for the result in ip.txt.During the execution time,you may go out and breath fresh air or have a cup of tea,not type in the Microsoft cmd any more!
Now,have a try by yourself!
rm -rf ./ip.txt
for i in `cat ./domain.txt`
echo -e 'BEGIN\n\n' >>ip.txt
ping $i -c 3 >>ip.txt
echo -e '\n\nEND\n' >>ip.txt
Put your list of domains in the file:
Now,please use cat ip.txt to see the joyful result!
I have known that the script in this article ping host one by one for 3 years(now is 2013). So I've written an upgraded rpm package called pping_doxer, which pings hosts in parallel and proves to be very efficient. You can read more about it on http://www.doxer.org/projects-doxer/.