Created
January 30, 2012 19:23
-
-
Save lukecampbell/1706124 to your computer and use it in GitHub Desktop.
Script to assist with couchdb and rabbitmq
This file contains 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/bash | |
# Author: Luke Campbell < [email protected] > | |
# Initialize and launch server and broker environements | |
RABBITMQ=/usr/local/sbin/rabbitmq-server | |
RABBITMQCTL=/usr/local/sbin/rabbitmqctl | |
COUCHDB=`which couchdb` | |
COUCHPID=/var/run/couchdb.pid | |
if [[ $UID != 0 ]]; then | |
echo " you are not root " | |
exit 1 | |
fi | |
start() | |
{ | |
echo "Launching Apache CouchDB" | |
$COUCHDB -b -p $COUCHPID | |
echo "Launching RabbitMQ Server" | |
$RABBITMQ -detached | |
} | |
stop() | |
{ | |
echo "Stopping Apache CouchDB" | |
PID=`cat $COUCHPID` | |
kill $PID | |
echo "Stopping RabbitMQ Server" | |
$RABBITMQCTL stop | |
} | |
status() | |
{ | |
if [[ -e $COUCHPID ]]; then | |
echo "CouchDB is running." | |
else | |
echo "CouchDB is not running." | |
fi | |
$RABBITMQCTL status | |
} | |
case $1 in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart) | |
stop | |
start | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment