#!/bin/sh
#
-# couchdb Starts CouchDB
+# couchdb Apache CouchDB init script
# chkconfig: 2345 84 25
-# description: Apache CouchDB init script
+# description: Apache CouchDB init script for the database server.
# pidfile: /var/run/couchdb.pid
#
# $Id$
COUCHDB_USER='couchdb'
COUCHDB_STDOUT='/dev/null'
COUCHDB_STDERR='/dev/null'
-COUCHDB_RESPAWN='5'
+COUCHDB_RESPAWN_TIMEOUT='0'
# Get service config - may override defaults
[ -f /etc/sysconfig/couchdb ] && . /etc/sysconfig/couchdb
&& touch $COUCHDB_PID \
&& chown $COUCHDB_USER $COUCHDB_PID
daemon --user $COUCHDB_USER $COUCHDB \
- -b -c "$COUCHDB_INI" -p "$COUCHDB_PID" \
- -o "$COUCHDB_STDOUT" -e "$COUCHDB_STDERR" \
- -r "$COUCHDB_RESPAWN"
+ -b -c "$COUCHDB_INI" -p "$COUCHDB_PID" \
+ -o "$COUCHDB_STDOUT" -e "$COUCHDB_STDERR" \
+ -r "$COUCHDB_RESPAWN_TIMEOUT" \
+ $COUCHDB_OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/couchdb
}
# Stop daemons.
msg_stopping "CouchDB"
- killproc --pidfile $COUCHDB_PID couchdb -TERM
+ su $COUCHDB_USER -c "$COUCHDB -d $COUCHDB_OPTIONS"
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ else
+ fail
+ fi
+
rm -f $COUCHDB_PID
rm -f /var/lock/subsys/couchdb
}
reload
;;
status)
+ # Display the status of the running Apache CouchDB process.
+ $COUCHDB -s
status couchdb
RETVAL=$?
;;