diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-09-04 07:45:39 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-09-04 07:47:42 -0300 |
commit | d1d3428a5ac98df5b8a33d4cd76a1852cf986ab5 (patch) | |
tree | ea862d8dc3b9442d472de2ec3dc5e08e40a0302b /usr/local/bin | |
parent | 43083402bf0dcad4813597a104d6643bfb128092 (diff) | |
download | pfsense-d1d3428a5ac98df5b8a33d4cd76a1852cf986ab5.zip pfsense-d1d3428a5ac98df5b8a33d4cd76a1852cf986ab5.tar.gz |
Mark host as up or down before execute script, then script can use this information.
Submitted by: Jean Debogue <jean@wedebugyou.com>
Diffstat (limited to 'usr/local/bin')
-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 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" |