"internet connection tester script"

James james at hicag.org
Sun Mar 28 03:37:11 UTC 2010


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.


More information about the freebsd-questions mailing list