Created
May 7, 2013 09:14
-
-
Save kenee/5531341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # chkconfig: - 85 15 | |
| # description: Startup script for the server of Rabbitmq | |
| # | |
| RABBITMQ=/usr/local/rabbitmq | |
| SBIN=$RABBITMQ/sbin/rabbitmq-server | |
| CONTROL=$RABBITMQ/sbin/rabbitmqctl | |
| PID=$RABBITMQ/var/lib/rabbitmq/mnesia/rabbit@`hostname -s`.pid | |
| RETVAL=0 | |
| #. /etc/rc.d/init.d/functions | |
| #export HOME=/usr/local/lib/erlang | |
| start(){ | |
| [ -e $PID ] && [ -s $PID ] && { | |
| echo "rabbitmq is already running..." | |
| exit 1 | |
| } | |
| echo -n "Starting rabbitmq: " | |
| $SBIN -detached | |
| RETVAL=$? | |
| [ $RETVAL -eq 0 ] && echo "rabbitmq is starting [OK]" | |
| } | |
| stop(){ | |
| echo -n "Stopping rabbitmq: " | |
| $CONTROL stop | |
| RETVAL=$? | |
| if [ $RETVAL -eq 0 ] ;then | |
| [ -e $PID ] && rm -f $PID | |
| echo "rabbitmq is stopping [OK]" | |
| fi | |
| } | |
| restart(){ | |
| stop | |
| sleep 2 | |
| start | |
| } | |
| case "$1" in | |
| start) start | |
| ;; | |
| stop) stop | |
| ;; | |
| status) $CONTROL status | |
| ;; | |
| rotate_logs) $CONTROL rotate_logs | |
| ;; | |
| restart) restart | |
| ;; | |
| *) echo $"Usage: $0 {start|stop|status|restart|rotate_logs}" | |
| exit 1 | |
| esac | |
| exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment