[rabbitmq-discuss] Problem with rabbitmq-server.init

Sundar cybertoast at gmail.com
Thu Sep 27 16:50:36 BST 2012

Hi Emile,
The problem is that I am trying to solve is as follows. I use
Ansible <http://ansible.cc> for my deployment process. Part of the
deployment process is to start/stop/restart certain services. What I found
is that running /etc/init.d/rabbitmq-server start would start the service,
but that the service would die right after the deployment task completed.

My understanding of debugging this problem is that the process is started
under the context of the deployer's connection to the remote host (the SSH
session) but as soon as that context dies the backgrounded process
(rabbitmq-server) also died. I was able to test this theory by putting in a
long wait at the end of the init.d/rabbitmq-server script and noticed that
the service stayed up during the wait, but as soon as the Ansible/Fabric
script exited the rabbitmq-server process also died. Note that this does
NOT happen under normal login. As a stop-gap fix I used nohup to ensure
that the process did not die, but upon discussion with others I was lead to
think that the init.d script may be malfunctioning.

Looking into the problem further I found that the Debian init script used
start-stop-daemon. The equivalent in RHEL seems to be the "daemon" function
in /etc/rc.d/init.d/functions. It's possible that I misunderstood this to
be present in all RHEL-type machines (it's present on my RHEL5.6+ and
CentOS 5.6+ machines).

Please let me know if the proposed fix is incorrect/problematic. I found
that applying this patch solved my problem, but perhaps there's a better
way to ensure that the backgrounded process (i.e., $START_PROG $DAEMON &)
does not die upon termination of the caller's shell context.

Thanks much.

On Thu, Sep 27, 2012 at 7:20 AM, Emile Joubert <emile at rabbitmq.com> wrote:

> On 27/09/12 12:10, Emile Joubert wrote:
> > "runuser". We are aware that this is not suitable for all RPM
> > distributions (notably SuSE) and we intend to correct that.
> Let me correct that: START_PROG is currently set to runuser for Fedora
> and setsid for SuSE-based distributions. We intend to make the scripts
> more idiomatic for SuSE.
> It is not clear from your patch what problem you are trying to solve.
> Perhaps if you explain more what you intended to achieve we can help.
> -Emile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120927/c34ff2a5/attachment.htm>

More information about the rabbitmq-discuss mailing list