using fping to monitor internet connection status
Pietro Cerutti
pietro.cerutti at gmail.com
Thu Jul 6 15:39:00 UTC 2006
On 7/6/06, Paul Hamilton <paulh at bdug.org.au> wrote:
> Hi,
Hallo,
>
> I need to monitor a number of IP addresses, so that if they ALL go down (say
> three IP's), then that is a pretty good indication that my server has lost
> internet connectivity.
[snip]
> Any idea's on a ping tool or simple script?
#!/bin/sh
err=2 # Ping return value on error
ping -c1 host1 > /dev/null 2>&1
host1=$?
ping -c1 host2 > /dev/null 2>&1
host2=$?
ping -c3 host3 > /dev/null 2>&1
host3=$?
if [ $host1 -gt $err -a $host2 -gt $err -a $host3 -gt $err ]; then
echo "Network is down..."
fi
Could surely be refined, but it works ;-)
> Regards,
>
> Paul Hamilton
> Busselton, 6280
> Australia
>
Regards,
--
Pietro Cerutti
ICQ: 117293691
PGP: 0x9571F78E
- ASCII Ribbon Campaign -
against HTML e-mail and
proprietary attachments
www.asciiribbon.org
More information about the freebsd-questions
mailing list