diff --git a/net/haproxy/src/etc/rc.syshook.d/50-haproxy.restart b/net/haproxy/src/etc/rc.syshook.d/50-haproxy.restart deleted file mode 100755 index 2784d4384..000000000 --- a/net/haproxy/src/etc/rc.syshook.d/50-haproxy.restart +++ /dev/null @@ -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 diff --git a/net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop b/net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop index cac76c6b6..e05a629cd 100755 --- a/net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop +++ b/net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop @@ -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 diff --git a/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh new file mode 100755 index 000000000..163448ab3 --- /dev/null +++ b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh @@ -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} diff --git a/net/haproxy/src/opnsense/service/conf/actions.d/actions_haproxy.conf b/net/haproxy/src/opnsense/service/conf/actions.d/actions_haproxy.conf index c68da0d51..1ee61b638 100644 --- a/net/haproxy/src/opnsense/service/conf/actions.d/actions_haproxy.conf +++ b/net/haproxy/src/opnsense/service/conf/actions.d/actions_haproxy.conf @@ -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