On 2011-11-23 21:16, Russell Coker wrote:
It's quite common for me to ping a server while
it's down. Often when doing
so I have a rough idea of how long it will take (for example rebooting the new
Hetzner servers I'm running in Germany takes about 160 seconds during which
there are no ping responses) so it's good to know how long it is before I
should expect a response. At other times I want a running count of how long
it's been down so I can give an accurate complaint when someone answers my
The standard ping programs tell you the packet count (which by default is 1
per second) when it receives a response. When there is no response nothing is
I would like a ping type program which will tell me how many seconds the
target has not been responding for.
Does anyone know of such a program?
I made a very cool discovery a couple of months ago: This can be done
with the 'ping' which ships with Debian Squeeze!
mattcen@owen:tmp$ dpkg -S $(which ping)
mattcen@owen:tmp$ dpkg -l iputils-ping
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version
ii iputils-ping 3:20100418-3 Tools to test the reachability of network hosts
mattcen@owen:tmp$ ping -D adam
PING adam.lan (192.168.2.2) 56(84) bytes of data.
[1322045416.121969] 64 bytes from adam.lan (192.168.2.2): icmp_req=1 ttl=64 time=0.052
[1322045417.123508] 64 bytes from adam.lan (192.168.2.2): icmp_req=2 ttl=64 time=0.059
[1322045418.125086] 64 bytes from adam.lan (192.168.2.2): icmp_req=3 ttl=64 time=0.042
[1322045419.127338] 64 bytes from adam.lan (192.168.2.2): icmp_req=4 ttl=64 time=0.059
--- adam.lan ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.042/0.053/0.059/0.007 ms
Unfortunately, this -D option is rather new (for example it's not
available in Ubuntu 10.04), so may not be available on all hosts you
use; I'm still trying to work out exactly which version introduced the
change, but I can't seem to find the upstream repository.