diff options
Diffstat (limited to 'system/rabbitmq-server/rc.rabbitmq')
-rw-r--r-- | system/rabbitmq-server/rc.rabbitmq | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/system/rabbitmq-server/rc.rabbitmq b/system/rabbitmq-server/rc.rabbitmq new file mode 100644 index 000000000000..9f6715bcc224 --- /dev/null +++ b/system/rabbitmq-server/rc.rabbitmq @@ -0,0 +1,45 @@ +#!/bin/sh +# Start/stop/restart Rabbit MQ daemon + +USER=rabbitmq +DAEMON_START_OPTS="-detached" + +rabbitmq_start(){ + sudo -u ${USER} sh -c "/usr/bin/rabbitmq-server ${DAEMON_START_OPTS}" +} + +rabbitmq_stop() { + sudo -u ${USER} sh -c "/usr/bin/rabbitmqctl stop" +} + +rabbitmq_restart() { + rabbitmq_stop + sleep 1 + rabbitmq_start +} + +rabbitmq_status() { + sudo -u ${USER} sh -c "/usr/bin/rabbitmqctl status" +} + +print_usage() { + echo "usage $0 start|stop|restart|status" +} + +case "$1" in + 'start') + rabbitmq_start + ;; + 'stop') + rabbitmq_stop + ;; + 'restart') + rabbitmq_restart + ;; + 'status') + rabbitmq_status + ;; + *) + print_usage + ;; +esac |