Skip to content

Instantly share code, notes, and snippets.

@lukecampbell
Created January 30, 2012 19:23
Show Gist options
  • Save lukecampbell/1706124 to your computer and use it in GitHub Desktop.
Save lukecampbell/1706124 to your computer and use it in GitHub Desktop.
Script to assist with couchdb and rabbitmq
#!/bin/bash
# Author: Luke Campbell < lcampbell@asascience.com >
# 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