Here's some instructions I've put together to convert it to using Upstart.
Install rabbitmq:
$ sudo apt-get install rabbitmq-server
It will automatically be started, so we first want to shut it down:
$ sudo /etc/init.d/rabbitmq-server stop
Now swap out the built-in /etc/init.d scripts for the Upstart job:
$ sudo rm /etc/rc0.d/K20rabbitmq-server \ /etc/rc1.d/K20rabbitmq-server \ /etc/rc2.d/S20rabbitmq-server \ /etc/rc3.d/S20rabbitmq-server \ /etc/rc4.d/S20rabbitmq-server \ /etc/rc5.d/S20rabbitmq-server \ /etc/rc6.d/K20rabbitmq-server
Put the following in /etc/init/rabbitmq-server.conf:
description "RabbitMQ Server" author "RabbitMQ" start on runlevel [2345] stop on runlevel [016] respawn exec /usr/sbin/rabbitmq-server > /var/log/rabbitmq/startup_log \ 2> /var/log/rabbitmq/startup_err post-start exec /usr/sbin/rabbitmqctl wait >/dev/null 2>&1
And you're done. You can now use:
sudo start rabbitmq-server
Notable differences between this job and the SysV script:
- A lock file is not support (it was disabled by default in the SysV script anyway)
- Shutdown is achieved via SIGTERM, rather than using rabbitmqctl stop. As a side effect, the /var/log/rabbitmq/shutdown_{log, err} files are not used.
Improved:
ReplyDeletedescription "RabbitMQ Server"
start on runlevel [2345]
stop on runlevel [016]
kill timeout 60
respawn
respawn limit 10 5
console log
setuid rabbitmq
setgid rabbitmq
env HOME=/var/lib/rabbitmq
exec /usr/lib/rabbitmq/bin/rabbitmq-server
post-start exec /usr/sbin/rabbitmqctl wait
pre-stop exec /usr/sbin/rabbitmqctl stop