I have been using ping -c1 -w1 on OpenWRT with the assumption that -w1 is going to let it wait for 1 millisecond, instead of default 4 seconds. But I noticed that if I do ping -c1 -w1 non-existing IP address
the result comes 4 seconds later, just like if I do ping -c1 non-existing IP address
I looked around and realized that on my Macbook Pro, "W" has to be capital, and it works what I expect: with ping -c1 -W1 non-existing IP, the result comes right away.
So I have an impression that -w1 is not doing anything. I tried with -W1, but it was the same thing. I don't get any error message like "invalid option" either. There is no man ping, so I can't look it up.
I would appreciate if someone could let me know what letter is correct for "ping wait" on openWRT, and what this "w" is doing instead of waiting 1ms. I am using it in a script which is supposed to tell me if access points are down. It's set for every 1 min. I have an AP for which I get about 2 Emails every day that it is "down", while a minute later I get an email that it's "up" now. I would like to know exactly how badly this AP is responding to ping: no reply for 4 sec, or no reply for 1ms. (Worry is rather about "VDSL converter" than the AP, actually.)
Just type ping and press Enter to see all supported options.
-W SEC Seconds to wait for the first response (default 10)
(after all -c CNT packets are sent)
-w SEC Seconds until ping exits (default:infinite)
(can exit earlier with -c CNT)
On my turris omnia with OpenWrt 19 derived turris OS 5, the iputuils ping will not take fractional seconds for either -W or -w, on ubunu 20 however it does, I have no data on current OpenWrt20 of snapshots.
Thank you all for your replies !! Wow, one second, not milli. I didn't know that this kind of commands can vary so much depending on platform ! Even the default is different from what I've read elsewhere.
As a matter of fact, n seconds works fine with me, don't really need mlliseconds.
I also didn't know that "man" was to be called up differently on openWRT: I was always looking up man on my powerbook, but if the contents are not even the same, it wont help at all;;
+1; macos is a BSD unix derivative with mostly BSD uitilities, while OpenWrt is a Linux based OS with either busybox ot Linux-derived utilities. Macos man pages often are still helpful (after all all pings on most OS are pretty similar) but not really that helpful if the goal is to find exact arguments for advanced invocations.