summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-09-04 07:45:39 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-09-04 07:47:24 -0300
commit1b5675a77e136768b974b002275b13a82623df3e (patch)
tree62a0d0484c6cfd4b85fa6d964e48fe9f385483d2
parent990162e36c70849dc3715caf2d256369b07e307a (diff)
downloadpfsense-1b5675a77e136768b974b002275b13a82623df3e.zip
pfsense-1b5675a77e136768b974b002275b13a82623df3e.tar.gz
Mark host as up or down before execute script, then script can use this information.
Submitted by: Jean Debogue <jean@wedebugyou.com>
-rwxr-xr-xusr/local/bin/ping_hosts.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh
index 30782b8..7126c99 100755
--- a/usr/local/bin/ping_hosts.sh
+++ b/usr/local/bin/ping_hosts.sh
@@ -85,23 +85,23 @@ for TOPING in $PINGHOSTS ; do
# Host is up
if [ "$PREVIOUSSTATUS" != "UP" ]; then
# Service restored
+ echo "UP" > /var/db/pingstatus/$DSTIP
if [ "$SERVICERESTOREDSCRIPT" != "" ]; then
echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT"
echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor
sh -c $SERVICERESTOREDSCRIPT
fi
- echo "UP" > /var/db/pingstatus/$DSTIP
fi
else
# Host is down
if [ "$PREVIOUSSTATUS" != "DOWN" ]; then
# Service is down
+ echo "DOWN" > /var/db/pingstatus/$DSTIP
if [ "$FAILURESCRIPT" != "" ]; then
echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT"
echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor
sh -c $FAILURESCRIPT
fi
- echo "DOWN" > /var/db/pingstatus/$DSTIP
fi
fi
echo "Checking ping time $DSTIP"
OpenPOWER on IntegriCloud