[CentOS] internet connection tester script
Philippe Naudin
philippe.naudin at supagro.inra.fr
Fri Jan 28 12:01:51 UTC 2011
Le ven 28 jan 2011 03:28:22 CET, kellyremo a écrit:
> [ ... ]
> $ while $TORF; do ping -W 1 -c 1 bix.hu >& /dev/null && ping -W 1 -c 1 www.yahoo.com >& /dev/null && TORF=false || TORF=true; done
> $
>
> It just doesn't work.
>
> Goal: if theres no internet connection, then the oneliner must loop until there is internet connection. if theres internet connection the oneliner ends.
>
> what am i missing?
try :
until ping -W 1 -c 1 bix.hu || ping -W 1 -c 1 www.yahoo.com ; do
sleep 5
done >& /dev/null
Note that ping -W 1 is crazy.
--
Philippe
More information about the CentOS
mailing list