[rabbitmq-discuss] Startup scripts on RedHat 5.6

Dan dan.j.richards at gmail.com
Mon Jun 6 17:03:30 BST 2011


Hi
Could you clarify the best practice for starting and stopping RabbitMQ
when using the generic source, please?
(We're using the generic to get the latest versions of Erlang and
Rabbit.)

Interactively it's all fine whilst logged on as the rabbit user.  I
can start from the command line with:
  rabbitmq_server-2.4.1/sbin/rabbitmq-server -detached
and stop with:
  rabbitmqctl stop

But if I do this as root it causes problems with the permissions on
the cookie and lock files, and I'd like RabbitMQ to start
automatically on system reboot.

I therefore took the '/etc/init.d/rabbitmq-server' startup script
provided in the Fedora RPM package, modified the paths and used
'chkconfig' to make it auto start, but this also ran everything as
root, so I've modified it to import the '/etc/rc.d/init.d/functions'
and call 'rabbitmq_server-2.4.1/sbin/rabbitmq-server' using the
'daemon' function which can take a '--user' parameter.

So rabbitmq starts correctly at system boot and root can run 'service
rabbitmq-server start | status | stop'.
If I'm the rabbit user I can start it up using either 'sudo service
rabbitmq-server start' or 'rabbitmq_server-2.4.1/sbin/rabbitmq-server -
detached', query the status using 'rabbitmqctl status' and stop it
using 'rabbitmqctl stop'.
Everything seems good to me, but I'd just like to check I'm doing the
right thing given this is a production environment...?  I'm sure this
problem has been solved already, so have I missed a trick with the
default RPM startup script? e.g. does it use the SUID bit or something
similar to achieve this?

Cheers

Dan


More information about the rabbitmq-discuss mailing list