[nycbug-talk] To ping or not to ping, that is the question...

Jonathan Stewart jonathan at kc8onw.net
Sat Jul 8 17:52:05 EDT 2006


Isaac Levy wrote:
> Hi Ray,
>
> On Jul 8, 2006, at 8:02 AM, Ray Lai wrote:
>
>> Just do:
>>
>> ray at x[~] COUNT=1; WAIT=1; ping -c "$COUNT" -w "$WAIT" google.com >/
>> dev/null && echo success || echo fail
>> success
>> ray at x[~] COUNT=1; WAIT=1; ping -c "$COUNT" -w "$WAIT" 10.0.1.9 >/
>> dev/null && echo success || echo fail
>> fail
>>
>> Unfortunately the -w flag only accepts integers, so the lowest
>> timeout you can set is one second.
>>
>> -Ray-
>
> Thanks, I can now say that Ray Lai taught me to ping.
>
> Problem: the wait function seems to not have much affect, if I ping
> an address I know doesn't exist, it still takes an indeterminate
> amount of time to return the failure...

I think you want -t instead of -w.  -t specifies the timeout for an
individual ping -w is the interval between pings when count is more than 1.

Jonathan



More information about the talk mailing list