Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Mar 2010 21:10:07 -0600
From:      James <james@hicag.org>
To:        FreeBSD questions <FreeBSD-questions@freebsd.org>
Subject:   Re: "internet connection tester script"
Message-ID:  <abd3d3c21003272010x6cb575d3w9fe115ab564a2da@mail.gmail.com>
In-Reply-To: <4BAEA222.2060904@daleco.biz>
References:  <1269691634.12702.11.camel@debian> <4BAEA222.2060904@daleco.biz>

next in thread | previous in thread | raw e-mail | index | archive | help
FWIW, here's what I use.  Requires net/fping.

#!/bin/sh

target=ip.address.of.next.hop.out

echo "- Started at `date`"

is_dead=0
while true; do
        fping -q $target
        fping_rc=$?

        if [ $is_dead -eq 0 -a $fping_rc -gt 0 ]; then
                echo "! Failure at `date`"
                is_dead=1
        fi
        if [ $is_dead -eq 1 -a $fping_rc -eq 0 ]; then
                echo "  Alive   at `date`"
                is_dead=0
        fi

        sleep 30
done

-- 
James.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?abd3d3c21003272010x6cb575d3w9fe115ab564a2da>