diff options
Diffstat (limited to 'dev-db/couchdb/files/couchdb.init-0.10')
-rw-r--r-- | dev-db/couchdb/files/couchdb.init-0.10 | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dev-db/couchdb/files/couchdb.init-0.10 b/dev-db/couchdb/files/couchdb.init-0.10 new file mode 100644 index 000000000000..d0017d791359 --- /dev/null +++ b/dev-db/couchdb/files/couchdb.init-0.10 @@ -0,0 +1,47 @@ +#!/sbin/runscript +# Copyright 2008 Dirkjan Ochtman +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +start() { + ebegin "Starting ${SVCNAME}" + + args="-b" + if test -n "$COUCHDB_STDOUT_FILE"; then + args="$args -o $COUCHDB_STDOUT_FILE" + fi + if test -n "$COUCHDB_STDERR_FILE"; then + args="$args -e $COUCHDB_STDERR_FILE" + fi + if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then + args="$args -r $COUCHDB_RESPAWN_TIMEOUT" + fi + if test -n "$COUCHDB_OPTIONS"; then + args="$args $COUCHDB_OPTIONS" + fi + if test -n "$COUCHDB_PID_FILE"; then + args="$args -p $COUCHDB_PID_FILE" + else + echo "* ERROR: COUCHDB_PID_FILE must be set" + return -1 + fi + if test -z "$COUCHDB_USER"; then + echo "* ERROR: COUCHDB_USER must be set" + return -1 + fi + + start-stop-daemon --start --exec ${EXEC} --name ${COUCHDB_BEAM} \ + --user ${COUCHDB_USER} --chuid ${COUCHDB_USER} --pidfile ${COUCHDB_PID_FILE} -- $args + + eend $? "Failed to start ${SVCNAME}" +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec ${EXEC} --name ${COUCHDB_BEAM} \ + --pidfile ${COUCHDB_PID_FILE} + eend $? "Failed to stop ${SVCNAME}" +} |