From 811ecea47ee06232423aa8ec393423905e209769 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 24 Dec 2013 12:08:19 -0200 Subject: test only does integer comparison, use bc to compare float --- usr/local/bin/ping_hosts.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 5e2f1c7..3858733 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -110,7 +110,7 @@ for TOPING in $PINGHOSTS ; do echo "Ping returned $?" echo $PINGTIME > /var/db/pingmsstatus/$DSTIP if [ "$THRESHOLD" != "" ]; then - if [ "$PINGTIME" -gt "$THRESHOLD" ]; then + if [ $(echo "${PINGTIME} > ${THRESHOLD}" | /usr/bin/bc) -eq 1 ]; then echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor sh -c $FAILURESCRIPT @@ -121,7 +121,7 @@ for TOPING in $PINGHOSTS ; do echo "Checking wan ping time $WANTIME" echo $WANTIME > /var/db/wanaverage if [ "$WANTHRESHOLD" != "" ]; then - if [ "$WANTIME" -gt "$WANTHRESHOLD" ]; then + if [ $(echo "${WANTIME} > ${WANTHRESHOLD}" | /usr/bin/bc) -eq 1 ]; then echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor sh -c $FAILURESCRIPT -- cgit v1.1