2007/12/05

smarter ping

while true ; do echo "`date`: `ping -qc1 domain-name | grep round-trip`"; sleep 5; done

A one-liner that does, in order:
  • show the date/time
  • show the *results* of a single ping (or nothing), on the same line
  • wait 5 seconds
  • do it all over again

And it simply does this til you kill it.

Why? Simply ping'ing doesn't give you any info on *when* things are happening - like when the server that you're waiting to reboot, did; or when the node you're testing stopped responding.

2 comments:

Anonymous said...

LOVELY! Just what I was looking for. Thank you.

Marcantonio Rendino said...

Terrific; one does attempt to give back a little. :)