Linux User wrote:

>Hello all,
>
>In man ping spune cam asa:
>     If ping does not receive any reply packets at all it will exit with code
>     1.  On error it exits with code 2. Otherwise it exits with code 0. This
>     makes it possible to use the exit code to see if a host is alive or not.
>
>CU ALTE CUVINTE:
>#Exit code = 1 -> Host Down
>#Exit code = 2 -> Host Up but are some errors
>#Exit code = 0 -> Host Up
>
>Cum fac sa preiau intr-o variabila $exit_code?
>
>Ma intereseaza sa analizez o retea, folosind acest feature al lui ping, ceva 
>de genul:
>
>for ...
>do
>if `ping -c 3 -w 3 $network.$i &> /dev/null`;
>    then echo 'Host Up';
>    else echo 'Host Down or Host Up but are some errors';
>#iar aici sa detaliez (daca este Down sau este Up dar cu ceva erori)
>fi
>done
>
>Regards,
>Alex
>
>
>
>
>  
>
 Tocmai lucrez la un programel care logheaza starea internetului. Acum 
ii fac si grafice sa vada isp-istul frumos cat de bine imi merge netu'. 
Daca il mai vrea si altcineva scream :). Sper ca nu reinventez roata :).


Raspunde prin e-mail lui