slackbuilds_ponce/system/rabbitmq-server/rc.rabbitmq
Andre Barboza 56adb73145 system/rabbitmq-server: Added (multi-protocol messaging broker).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2015-12-31 00:04:44 +07:00

45 lines
651 B
Bash

#!/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