diff options
author | Seth Mos <seth.mos@dds.nl> | 2011-03-16 13:26:46 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2011-03-16 13:26:46 +0100 |
commit | e3e85044d1889a95c4d4a7245b09ca7b80512894 (patch) | |
tree | 8250ea5dd7981fc628932a755575889e65def20f /usr/local/bin | |
parent | 840d845fdac96ec4284a06ca3152e534b33bfc7e (diff) | |
download | pfsense-e3e85044d1889a95c4d4a7245b09ca7b80512894.zip pfsense-e3e85044d1889a95c4d4a7245b09ca7b80512894.tar.gz |
Add field 8 for address family
Diffstat (limited to 'usr/local/bin')
-rwxr-xr-x | usr/local/bin/ping_hosts.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 97629c4..19a6161 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -13,6 +13,7 @@ # Field 5: Script to run once service is restored # Field 6: Ping time threshold # Field 7: Wan ping time threshold +# Field 8: Address family # Read in ipsec ping hosts and check the CARP status if [ -f /var/db/ipsecpinghosts ]; then @@ -66,9 +67,15 @@ for TOPING in $PINGHOSTS ; do SERVICERESTOREDSCRIPT=`echo $TOPING | cut -d"|" -f5` THRESHOLD=`echo $TOPING | cut -d"|" -f6` WANTHRESHOLD=`echo $TOPING | cut -d"|" -f7` + AF=`echo $TOPING | cut -d"|" -f8` + if [ "$AF" == "inet" ]; then + PINGCMD=ping + else + PINGCMD=ping6 + fi echo Processing $DSTIP # Look for a service being down - ping -c $COUNT -S $SRCIP $DSTIP + $PINGCMD -c $COUNT -S $SRCIP $DSTIP if [ $? -eq 0 ]; then # Host is up # Read in previous status @@ -97,7 +104,7 @@ for TOPING in $PINGHOSTS ; do fi echo "Checking ping time $DSTIP" # Look at ping values themselves - PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` + PINGTIME=`$PINGCMD -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` echo "Ping returned $?" echo $PINGTIME > /var/db/pingmsstatus/$DSTIP if [ "$THRESHOLD" != "" ]; then |