From f39b219f5749d7b2dc3f46bfda9de37e9b5f1625 Mon Sep 17 00:00:00 2001 From: Jimmy Olgeni Date: Fri, 17 Feb 2023 20:40:18 +0100 Subject: net/rabbitmq: rc.d improvements This commit creates a separate directory at /var/run/rabbitmq to host the RabbitMQ pid file. Previously, the pid file was not being created properly (it was empty) and this was causing issues with the process of waiting for pids (as the pid file existed, but had no value and was considered "garbage"). With this change the pid file is created with the correct value, enabling the process of waiting for pids to complete successfully; now the startup script returns exit code 0. Additionally, this commit exports the variables RABBITMQ_HOME, RABBITMQ_LOG_BASE, and RABBITMQ_PID_FILE so that the RabbitMQ process can properly locate the pid file. These changes resolve PR 264062. PR: 264062 Reported by: FiLiS --- net/rabbitmq/files/rabbitmq.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'net/rabbitmq/files/rabbitmq.in') diff --git a/net/rabbitmq/files/rabbitmq.in b/net/rabbitmq/files/rabbitmq.in index 0e0024484e8e..b2581043633d 100644 --- a/net/rabbitmq/files/rabbitmq.in +++ b/net/rabbitmq/files/rabbitmq.in @@ -23,7 +23,7 @@ load_rc_config $name rabbitmq_server="%%PREFIX%%/sbin/rabbitmq-server" rabbitmq_ctl="%%PREFIX%%/sbin/rabbitmqctl" rabbitmq_env_conf="%%PREFIX%%/etc/rabbitmq/rabbitmq-env.conf" -pidfile="/var/run/${name}.pid" +pidfile="/var/run/rabbitmq/${name}.pid" start_cmd="${name}_start" stop_cmd="${name}_stop" @@ -64,7 +64,11 @@ rabbitmq_start() chmod 600 ${RABBITMQ_HOME}/.erlang.cookie fi - install -o ${rabbitmq_user} /dev/null ${pidfile} + install -d -o ${rabbitmq_user} -g ${rabbitmq_user} /var/run/${name} + + export RABBITMQ_HOME RABBITMQ_LOG_BASE RABBITMQ_PID_FILE + + rm -f ${pidfile} debug "Running: rabbitmq-server -detached" su -m ${rabbitmq_user} -c "${rabbitmq_server} -detached" >/dev/null 2>&1 @@ -75,6 +79,7 @@ rabbitmq_start() rabbitmq_stop() { echo "Stopping ${name}." + if [ -f ${pidfile} ]; then debug "Running: ${rabbitmq_ctl} stop ${pidfile}" su -m ${rabbitmq_user} -c "${rabbitmq_ctl} stop ${pidfile}" >/dev/null 2>&1 -- cgit v1.2.3