diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-12-24 12:08:19 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-12-24 12:16:48 -0200 |
commit | 811ecea47ee06232423aa8ec393423905e209769 (patch) | |
tree | d63c701f75460a5eb0ef7214ea09455f140224f7 | |
parent | 8f105c8a9e36c5b84eef754638dd963f50995fec (diff) | |
download | pfsense-811ecea47ee06232423aa8ec393423905e209769.zip pfsense-811ecea47ee06232423aa8ec393423905e209769.tar.gz |
test only does integer comparison, use bc to compare float
-rwxr-xr-x | usr/local/bin/ping_hosts.sh | 4 |
1 files changed, 2 insertions, 2 deletions
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 |