Re: Shell script - ping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Gopinath Achari wrote:
hi,

		how to write a scripts which launches 10 pings to different
destinations at execution of single shell scripts

please help me any ideas

regards,
Gopinath
Do you mean something like:
ping -c10 host1
ping -c10 host2
....
which will ping host1 10 times, then host2 10 times etc. (see `man ping` for details of the options).

If you have a list of hosts in a file, you could do:
for host in `cat [filename]`
do
	ping -c10 $host
done

or:

while read host
do
	ping -c10 $host
done << [filename]

If you only want to ping each host once, you can substitute '-c10' with '-c1' (again, see the man page).

Hope this helps
Laurence
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux