aboutsummaryrefslogtreecommitdiffstats
path: root/net/haproxy
diff options
context:
space:
mode:
authordemon <demon@FreeBSD.org>2017-08-16 16:06:57 +0800
committerdemon <demon@FreeBSD.org>2017-08-16 16:06:57 +0800
commitbb7b72161d999da69c74019e795b2cbe063ff091 (patch)
treef9c392d68784464af3f57491404ebe409977b1a7 /net/haproxy
parent97e163318b36c96f92e0a560bb45b4ac8d5a4080 (diff)
downloadfreebsd-ports-gnome-bb7b72161d999da69c74019e795b2cbe063ff091.tar.gz
freebsd-ports-gnome-bb7b72161d999da69c74019e795b2cbe063ff091.tar.zst
freebsd-ports-gnome-bb7b72161d999da69c74019e795b2cbe063ff091.zip
Add hardstop/hardreload commands to rc script (to stop/reload haproxy without
waiting for existing connections to close). PR: 221402 Submitted by: Frank Wall <fw@moov.de>
Diffstat (limited to 'net/haproxy')
-rw-r--r--net/haproxy/files/haproxy.in26
1 files changed, 17 insertions, 9 deletions
diff --git a/net/haproxy/files/haproxy.in b/net/haproxy/files/haproxy.in
index 751b3067d083..3e2d8b3a034e 100644
--- a/net/haproxy/files/haproxy.in
+++ b/net/haproxy/files/haproxy.in
@@ -29,17 +29,27 @@
name="haproxy"
rcvar=haproxy_enable
command="%%PREFIX%%/sbin/haproxy"
-extra_commands="reload configtest"
+extra_commands="reload configtest hardstop hardreload"
reload_cmd="haproxy_reload"
+hardreload_cmd="haproxy_reload"
+hardreload_precmd="def_hardreload_option"
stop_cmd="haproxy_stop"
+hardstop_cmd="haproxy_stop"
+hardstop_precmd="def_hardstop_signal"
: ${haproxy_enable:="NO"}
: ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"}
pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"}
-if [ -z "$rc_force" ]; then
- sig_stop="USR1"
-fi
+def_hardreload_option()
+{
+ reload_opt="-st"
+}
+
+def_hardstop_signal()
+{
+ sig_stop="TERM"
+}
load_rc_config $name
@@ -81,6 +91,8 @@ fi
configtest_cmd="$command -c -f $haproxy_config"
start_precmd="$command -q -c -f $haproxy_config"
required_files=$haproxy_config
+sig_stop=SIGUSR1
+reload_opt="-sf"
haproxy_reload()
{
@@ -90,11 +102,7 @@ haproxy_reload()
fi
rc_pid=$(check_pidfile ${pidfile} ${command})
if [ $rc_pid ]; then
- if [ -z "$rc_force" ]; then
- ${command} ${haproxy_flags} -sf $(cat ${pidfile})
- else
- ${command} ${haproxy_flags} -st $(cat ${pidfile})
- fi
+ ${command} ${haproxy_flags} $reload_opt $(cat ${pidfile})
else
_run_rc_notrunning
return 1