mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
56adb73145
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
45 lines
651 B
Bash
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
|