Acho que o problema está no script de inicialização , não respeita a especificação LSB .
Se você observar a função haproxy_stop
, no arquivo /etc/init.d/haproxy
:
haproxy_stop()
{
if [ ! -f $PIDFILE ] ; then
# This is a success according to LSB
return 0
fi
for pid in $(cat $PIDFILE) ; do
/bin/kill $pid || return 4
done
rm -f $PIDFILE
return 0
}
Em particular, a linha /bin/kill $pid || return 4
. Isso faz com que o processo seja eliminado e o valor de retorno é 4, o que, de acordo com a especificação, é: o usuário tinha privilégios insuficientes . O que não está correto.
In case of an error while processing any init-script action except for status, the init script shall print an error message and exit with a non-zero status code:
1 generic or unspecified error (current practice) 2 invalid or excess argument(s) 3 unimplemented feature (for example, "reload") 4 user had insufficient privilege 5 program is not installed 6 program is not configured 7 program is not running 8-99 reserved for future LSB use 100-149 reserved for distribution use 150-199 reserved for application use 200-254 reserved
Você pode tentar alterar por:
/bin/kill $pid || return 7
a maneira correta é parar o daemon com killproc ( 8) e se isso falhar killproc
define o valor de retorno de acordo com o LSB.
Eg.
/sbin/killproc -p $PIDFILE $HAPROXY
sends the signal SIGTERM to the pid found in
$PIDFILE
if and only if this pid belongs to $HAPROXY. If the named$PIDFILE
does not exist, killproc assumes that the daemon of $HAPROXY is not running. The exit status is set to 0 for successfully delivering the default signals SIGTERM and SIGKILL otherwise to 7 if the program was not running. It is also successful if no signal was specified and no program was there for Termination because it is already terminated.