diff options
author | Patrick Lauer <patrick@gentoo.org> | 2017-11-30 07:20:59 +0000 |
---|---|---|
committer | Patrick Lauer <patrick@gentoo.org> | 2017-11-30 07:20:59 +0000 |
commit | 1016c8d09a77369c4b37e511bf6b3f03922f7c23 (patch) | |
tree | b4d41e9a7e49980514e163b16ac1843df36dd478 /net-proxy/haproxy/files | |
parent | media-libs/mesa: Print full path to patents.txt (diff) | |
download | gentoo-1016c8d09a77369c4b37e511bf6b3f03922f7c23.tar.gz gentoo-1016c8d09a77369c4b37e511bf6b3f03922f7c23.tar.bz2 gentoo-1016c8d09a77369c4b37e511bf6b3f03922f7c23.zip |
net-proxy/haproxy: Fix init script
The change in https://bugs.gentoo.org/show_bug.cgi?id=584410 only worked because of
multiple bugs interacting.
Due to variable shadowing https://bugs.gentoo.org/show_bug.cgi?id=639164 the loop did not
actually work, and the /run/haproxy.pid was used in every loop iteration.
This only worked because of a bug in openrc: https://bugs.gentoo.org/show_bug.cgi?id=639218
which was fixed in 0.34.11
So before it killed all processes called haproxy if nbproc > 1 in the config
(which means multiple haproxy instances are all killed if one is stopped!)
After the bugfix it doesn't kill, so we're back to the original situation of leftover
processes. And we don't want to rely on the cgroup killer!
The fix is obviously to use start-stop-daemon directly instead of calling openrc
internals that don't do what you think they do.
Package-Manager: Portage-2.3.16, Repoman-2.3.6
RepoMan-Options: --force
Diffstat (limited to 'net-proxy/haproxy/files')
-rw-r--r-- | net-proxy/haproxy/files/haproxy.initd-r4 | 85 | ||||
-rw-r--r-- | net-proxy/haproxy/files/haproxy.initd-r6 (renamed from net-proxy/haproxy/files/haproxy.initd-r5) | 2 |
2 files changed, 1 insertions, 86 deletions
diff --git a/net-proxy/haproxy/files/haproxy.initd-r4 b/net-proxy/haproxy/files/haproxy.initd-r4 deleted file mode 100644 index c37719b16752..000000000000 --- a/net-proxy/haproxy/files/haproxy.initd-r4 +++ /dev/null @@ -1,85 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -extra_commands="checkconfig" -extra_started_commands="reload" - -command="/usr/bin/haproxy" - -pidfile="${HAPROXY_PIDFILE:-/run/${SVCNAME}.pid}" - -configs= - -if [ -z "${CONFIGS}" ]; then - if [ -f "/etc/haproxy/${SVCNAME}.cfg" ]; then - CONFIGS=/etc/haproxy/${SVCNAME}.cfg - elif [ -f "/etc/${SVCNAME}.cfg" ]; then - CONFIGS=/etc/${SVCNAME}.cfg # Deprecated - fi -fi - -for conf in $CONFIGS; do - configs="${configs} -f ${conf}" -done - -command_args="-D -p ${pidfile} ${configs} ${HAPROXY_OPTS}" - -depend() { - need net - use dns logger -} - -checkconfig() { - if [ -z "${CONFIGS}" ]; then - eerror "No config(s) has been specified" - return 1 - fi - - for conf in $CONFIGS; do - if [ ! -f "${conf}" ]; then - eerror "${conf} does not exist!" - return 1 - fi - done - - ebegin "Checking ${CONFIGS}" - $command -q -c $configs $HAPROXY_OPTS - eend $? -} - -start_pre() { - if [ "${RC_CMD}" != "restart" ]; then - checkconfig || return 1 - fi -} - -stop_pre() { - if [ "${RC_CMD}" = "restart" ]; then - checkconfig || return 1 - fi -} - -stop() { - local _t _pid - - _t="$(mktemp)" - for _pid in $(cat ${pidfile}) ; do - echo "${_pid}" > "${_t}" - pidfile="${_t}" default_stop - done - rm -f "${_t}" -} - -reload() { - checkconfig || { eerror "Reloading failed, please fix your config(s) first"; return 1; } - - if [ "$(command -v reload_seamless)" = "reload_seamless" ]; then - einfo "Calling user-defined reload_seamless()" - reload_seamless || { eerror "reload_seamless() failed!"; return 1; } - fi - - ebegin "Reloading ${SVCNAME}" - $command -D -p "${pidfile}" $configs $HAPROXY_OPTS -sf $(cat "${pidfile}") - eend $? -} diff --git a/net-proxy/haproxy/files/haproxy.initd-r5 b/net-proxy/haproxy/files/haproxy.initd-r6 index 0f2435f74339..9b7c5fe973ba 100644 --- a/net-proxy/haproxy/files/haproxy.initd-r5 +++ b/net-proxy/haproxy/files/haproxy.initd-r6 @@ -66,7 +66,7 @@ stop() { _t="$(mktemp)" for _pid in $(cat ${pidfile}) ; do echo "${_pid}" > "${_t}" - pidfile="${_t}" default_stop + start-stop-daemon --stop --pidfile="${_t}" done rm -f "${_t}" } |