I have a script for checking an unsuccesful ping, and I use the return
value:

ping -c 1 www.yahoo.com 1>/dev/null 2>/dev/null
if [ "$?" != "0" ]; then
        An error has occured
else
        Ping went OK
fi

See, ping has a return code 0 for a successfull ping, and 1 or 2 for an
error, depending on the error type.

Luis

On Thu, 1 Feb 2001, SoloCDM wrote:

> I'm using the following to check for an unsuccessful ping, but if
> the line is open and bottlenecked enough to return a hundred percent
> loss, then the ping will return a false identity.  Any suggestions?
>
> ping -c 4 -R mail.aculink.net > search-opening-data 2>&1;
> MOKAY=`egrep -ie packets search-opening-data | gawk -F " " '{print
> $7}'`; if [ "${MOKAY}" = "100%" ]
>
>
> Ignore the omittance of the remaining "if" statement.
>
> Note: When you reply to this message, please include the mailing
>       list/newsgroup address in Cc: and my email address in To:.
>
> *********************************************************************
> Signed,
> SoloCDM
>
>


Reply via email to