system: split off monitor reload for upcoming dpinger integration

This commit is contained in:
Franco Fichtner 2018-04-10 08:47:45 +02:00
parent 6c4ee8a945
commit 6fb26f989b
3 changed files with 42 additions and 2 deletions

1
plist
View File

@ -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

View File

@ -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
}

39
src/etc/rc.monitor Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# Copyright (c) 2018 Franco Fichtner <franco@opnsense.org>
#
# 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}"