[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: whats wrong with my internet connection checker script?



On Sun, 26 Dec 2010 14:30:36 -0800, S Mathias wrote:

(...)

> ping -W 1 -c 4 google.com >& /dev/null | grep "100% packet loss" $
> ping -W 1 -c 4 www.yahoo.com >& /dev/null | grep "100% packet loss" $
> 
> 
> 
> ...both sides "false", because they have no output, because google.com
> and www.yahoo.com is reachable. how come it writes "no internet
> connection"? [at the longest line] i just want a "oneliner" that checks
> if theres "internet connection" or no. :\
> 
> where did i screw up? 8)

Just a side note. 

A "ping" test is not a proof that your connection is "alive". There can 
be situations (outside your scope) in that your connection goes through a 
firewall or router that is configured to reject pings and your test will 
fail but that is not a sympthom that your DSL link is down.

Whether possible, you better monitor your dsl router and query about its 
connection status (there are some models that allow sending internal logs 
to your syslog and you can then make an alert -i.e., send an e-mail- when 
DSL status goes down. Another devices can trigger these alerts -system/
link down- automatically).

Greetings,

-- 
Camaleón


Reply to: