aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/haproxy-devel/files/haproxy.in42
1 files changed, 12 insertions, 30 deletions
diff --git a/net/haproxy-devel/files/haproxy.in b/net/haproxy-devel/files/haproxy.in
index 823eb10109e5..73031792bc3b 100644
--- a/net/haproxy-devel/files/haproxy.in
+++ b/net/haproxy-devel/files/haproxy.in
@@ -43,28 +43,31 @@ command="%%PREFIX%%/sbin/haproxy"
# Load Configs/Set Defaults
load_rc_config $name
: ${haproxy_enable:="NO"}
+pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"}
: ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"}
-: ${haproxy_pidfile:="/var/run/${name}.pid"}
-: ${haproxy_flags="-q -f ${haproxy_config} -p ${haproxy_pidfile}"}
+: ${haproxy_flags="-q -f ${haproxy_config} -p ${pidfile}"}
# Update the globals
-pidfile=${haproxy_pidfile}
-required_files=${haproxy_config}
+required_files=$haproxy_config
# Commands: start, stop, restart, reload, configtest
extra_commands="reload configtest"
-configtest_cmd="haproxy_checkconfig"
+configtest_cmd="$command -c -f $haproxy_config"
+start_precmd="$command -q -c -f $haproxy_config"
reload_cmd="haproxy_reload"
+# For stopping, SIGUSR1 = softstop, SIGTERM = faststop
+sig_stop=${rc_force:-USR1}
+
haproxy_reload()
{
# Check configuration file quietly first
${command} -q -c -f ${haproxy_config}
if [ $? -ne 0 ]; then
- err 1 "Error found in ${haproxy_config} - not reloading current process!"
+ err 1 "Error found in ${haproxy_config} - not reloading current process!"
fi
- rc_pid=$(check_pidfile ${haproxy_pidfile} ${command})
+ rc_pid=$(check_pidfile ${pidfile} ${command})
if [ $rc_pid ]; then
if [ $rc_force ]; then
${command} ${haproxy_flags} -st ${rc_pid}
@@ -72,30 +75,9 @@ haproxy_reload()
${command} ${haproxy_flags} -sf ${rc_pid}
fi
else
- err 1 "No process found. Maybe $command isn't running?"
+ _run_rc_notrunning
+ return 1
fi
}
-haproxy_checkconfig()
-{
- ${command} -c -f ${haproxy_config}
-}
-
-haproxy_prestart()
-{
- ${command} -q -c -f ${haproxy_config}
- rc_flags=${haproxy_flags}
-}
-
-haproxy_prestop()
-{
- # SIGUSR1 = softstop, SIGTERM = faststop
- if [ $rc_force ]; then
- sig_stop="SIGTERM"
- else
- sig_stop="SIGUSR1"
- fi
-}
-
-
run_rc_command "$1"