Skip to content

Instantly share code, notes, and snippets.

@nofxx
Created September 7, 2009 23:33
Show Gist options
  • Save nofxx/182618 to your computer and use it in GitHub Desktop.
Save nofxx/182618 to your computer and use it in GitHub Desktop.
## /etc/rc.d/rabbitmq [shell-unix-generic]
#!/bin/bash
daemon_name=rabbitmq-multi
node_count=1
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting $daemon_name daemon"
# RUN
/usr/bin/$daemon_name start_all $node_count > /var/log/rabbitmq/startup 2> /var/log/rabbitmq/startup_err
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
# To make a .pid file available on /var/run (for god, monit)
sed 's/.*,\(.*\)\}.*/\1/' /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid
add_daemon $daemon_name
stat_done
fi
;;
stop)
stat_busy "Stopping $daemon_name daemon"
# KILL
/usr/bin/$daemon_name stop_all > /var/log/rabbitmq/shutdown 2> /var/log/rabbitmq/shutdown_err
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
rm_daemon $daemon_name
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
status)
stat_busy "Checking $daemon_name status";
ck_status $daemon_name
;;
*)
echo "usage: $0 {start|stop|restart|status}"
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment