ping with timestamp

I couldn’t work out a way to get ping to print a timestamp of when the ping took place. For some reason it seems as though this isn’t a sought after feature.
Luckily you can achieve the same thing using fping:

while [ 1 ] ; do echo $(date '+%F %T') $(fping -e; sleep 1; done

Gives the following output:
2008-03-18 11:06:54 is alive (250 ms)
2008-03-18 11:06:56 is alive (248 ms)
2008-03-18 11:06:57 is alive (268 ms)
2008-03-18 11:06:58 is alive (250 ms)
2008-03-18 11:07:00 is alive (250 ms)






One response to “ping with timestamp”

  1. Jason Lewis Avatar
    Jason Lewis

    finally fixed the stupid fancy quotes wordpress insists on mangling in my nice bash code. You’d think that if you put around some text, wordpress would realise it shouldn’t be messed with.

Leave a Reply

Your email address will not be published. Required fields are marked *