net/haproxy: use rc wrapper script to set hard/graceful mode, refs #195

This commit is contained in:
Frank Wall 2017-08-16 12:11:28 +02:00
parent 472d5d601e
commit 2f875dc2cc
4 changed files with 20 additions and 16 deletions

View file

@ -1,7 +0,0 @@
#!/bin/sh
. /etc/rc.conf.d/haproxy
if [ "x${haproxy_hardstop}" == "xYES" ]; then
/usr/local/etc/rc.d/haproxy configtest && /usr/local/etc/rc.d/haproxy hardstop
fi

View file

@ -1,7 +1,3 @@
#!/bin/sh
. /etc/rc.conf.d/haproxy
if [ "x${haproxy_hardstop}" == "xYES" ]; then
/usr/local/etc/rc.d/haproxy hardstop
fi
/usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh stop

View file

@ -0,0 +1,15 @@
#!/bin/sh
if [ -f /etc/rc.conf.d/haproxy ]; then
. /etc/rc.conf.d/haproxy
fi
case "$1" in
stop|restart)
if [ "${haproxy_hardstop}" == "YES" ]; then
rcprefix="hard"
fi
;;
esac
/usr/local/etc/rc.d/haproxy ${rcprefix}${1}

View file

@ -5,25 +5,25 @@ type:script_output
message:setup haproxy service requirements
[start]
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.d/haproxy start
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh start
parameters:
type:script
message:starting haproxy
[stop]
command:/usr/local/etc/rc.syshook.d/50-haproxy.stop; /usr/local/etc/rc.d/haproxy stop; /usr/bin/killall haproxy; exit 0
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh stop; /usr/bin/killall haproxy; exit 0
parameters:
type:script
message:stopping haproxy
[restart]
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.syshook.d/50-haproxy.restart; /usr/local/etc/rc.d/haproxy restart
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh restart
parameters:
type:script
message:restarting haproxy
[reconfigure]
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.d/haproxy reload
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh reload
parameters:
type:script
message:reconfiguring haproxy