From 6fb26f989ba30d17ae595d30ce654a3fab959ae6 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 10 Apr 2018 08:47:45 +0200 Subject: [PATCH] system: split off monitor reload for upcoming dpinger integration --- plist | 1 + src/etc/inc/gwlb.inc | 4 ++-- src/etc/rc.monitor | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 src/etc/rc.monitor diff --git a/plist b/plist index 0ab44ff66..0fd3677fa 100644 --- a/plist +++ b/plist @@ -120,6 +120,7 @@ /usr/local/etc/rc.loader.d/20-misc /usr/local/etc/rc.loader.d/20-modules /usr/local/etc/rc.loader.d/20-netgraph +/usr/local/etc/rc.monitor /usr/local/etc/rc.newwanip /usr/local/etc/rc.newwanipv6 /usr/local/etc/rc.openvpn diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 0d5517a71..984718f89 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -94,8 +94,8 @@ rrd interval 60s; ## These parameters can be overridden in a specific alarm configuration alarm default { - command on "/usr/local/opnsense/service/configd_ctl.py -m 'filter reload' 'openvpn reload %T' 'dyndns reload %T' 'rfc2136 reload %T'" - command off "/usr/local/opnsense/service/configd_ctl.py -m 'filter reload' 'openvpn reload %T' 'dyndns reload %T' 'rfc2136 reload %T'" + command on "/usr/local/etc/rc.monitor %T" + command off "/usr/local/etc/rc.monitor %T" combine 10s } diff --git a/src/etc/rc.monitor b/src/etc/rc.monitor new file mode 100755 index 000000000..2fdf67f47 --- /dev/null +++ b/src/etc/rc.monitor @@ -0,0 +1,39 @@ +#!/bin/sh + +# Copyright (c) 2018 Franco Fichtner +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +GATEWAY="${1}" + +if [ -z "${GATEWAY}" ]; then + # require a gateway + exit 1 +fi + +/usr/local/opnsense/service/configd_ctl.py -m \ + "filter reload" \ + "openvpn reload ${GATEWAY}" \ + "dyndns reload ${GATEWAY}" \ + "rfc2136 reload ${GATEWAY}"