Red Hat Bugzilla – Bug 105678
ping's exit code could be more useful
Last modified: 2015-03-04 20:12:53 EST
If you specify both -c and -w switches, and the exit
code is 1, you don't know whether the host is alive
or not just by the exit code, since either no reply
packets have been received, or some reply packets *were*
recieved but the program timed out before the *full*
quota of packets expected in the -c value were received
(e.g. with -c 5 any number of replies between 1 and 4
would result in an exit code of 1).
That means that you have to look at STDOUT to determine
whether a host was alive, which makes scripting etc.
a lot more awkward.
Why don't you use -c 1 -W 10 for example then? This should do what you
want as if it fails then the host was not reachable, otherwise it was
Read ya, Phil