Created
May 19, 2009 01:33
-
-
Save TheNicholasNick/113862 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 | |
# | |
# couchdb - this script starts and stops the couchdb server | |
# | |
# chkconfig: - 85 15 | |
# description: Apache CouchDB document database server. | |
# processname: beam | |
# pidfile: /opt/couchdb/var/run/couchdb/couchdb.pid | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# Source networking configuration. | |
. /etc/sysconfig/network | |
# Check that networking is up. | |
[ "$NETWORKING" = "no" ] && exit 0 | |
retval=0 | |
start() { | |
echo -n $"Starting CouchDB: " | |
su couchdb -c "/opt/couchdb/bin/couchdb -p /opt/couchdb/var/run/couchdb/couchdb.pid -b -o /dev/null -e /dev/null" > /dev/null 2>&1 | |
retval=$? | |
[ $retval -eq 0 ] && success $"CouchDB started" || failure $"CouchDB failed to start" | |
echo | |
return $retval | |
} | |
stop() { | |
echo -n $"Stopping CouchDB: " | |
su couchdb -c "/opt/couchdb/bin/couchdb -p /opt/couchdb/var/run/couchdb/couchdb.pid -d -o /dev/null -e /dev/null" > /dev/null 2>&1 | |
retval=$? | |
[ $retval -eq 0 ] && success $"CouchDB shutdown" && rm -f /opt/couchdb/var/run/couchdb/couchdb.pid || failure $"CouchDB failed to shutdown" | |
echo | |
return $retval | |
} | |
restart() { | |
stop | |
sleep 1 | |
start | |
} | |
status() { | |
su couchdb -c "/opt/couchdb/bin/couchdb -p /opt/couchdb/var/run/couchdb/couchdb.pid -s -o /dev/null -e /dev/null" | |
} | |
case "$1" in | |
start) | |
$1 | |
;; | |
stop) | |
$1 | |
;; | |
restart) | |
$1 | |
;; | |
status) | |
$1 | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart}" | |
exit 2 | |
esac | |
exit $retval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment