I need the option of ping which,If the net is disconnected, the pinging need to be stopped.Now if the net connection lost,It will wait and will continue after net came..
1 Answer
See man ping
-c count
Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the time‐ out expires.
$ ping www.google.nl -c 5 PING www.l.google.com (66.102.13.104) 56(84) bytes of data. 64 bytes from ez-in-f104.1e100.net (66.102.13.104): icmp_req=1 ttl=53 time=18.4 ms 64 bytes from ez-in-f104.1e100.net (66.102.13.104): icmp_req=2 ttl=53 time=18.8 ms 64 bytes from ez-in-f104.1e100.net (66.102.13.104): icmp_req=3 ttl=53 time=15.1 ms 64 bytes from ez-in-f104.1e100.net (66.102.13.104): icmp_req=4 ttl=54 time=16.8 ms 64 bytes from ez-in-f104.1e100.net (66.102.13.104): icmp_req=5 ttl=54 time=19.6 ms --- www.l.google.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 15.133/17.781/19.660/1.615 ms