3 # couchdb Starts CouchDB
5 # chkconfig: 2345 84 25
6 # description: Apache CouchDB init script
7 # pidfile: /var/run/couchdb.pid
9 # Source function library
10 . /etc/rc.d/init.d/functions
13 COUCHDB=/usr/bin/couchdb
14 RUN_DIR=/var/run/couchdb
18 if [ -f /etc/sysconfig/couchdb ]; then
19 . /etc/sysconfig/couchdb
24 # Check if the service is already running?
25 if [ ! -f /var/lock/subsys/couchdb ]; then
26 msg_starting "CouchDB"
28 command="$COUCHDB -b -p /var/run/couchdb.pid"
30 if test -n "$COUCHDB_STDOUT_FILE"; then
31 command="$command -o $COUCHDB_STDOUT_FILE"
34 if test -n "$COUCHDB_STDERR_FILE"; then
35 command="$command -e $COUCHDB_STDERR_FILE"
38 if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
39 command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
42 if test -n "$COUCHDB_OPTIONS"; then
43 command="$command $COUCHDB_OPTIONS"
47 touch /var/run/couchdb.pid && chown $COUCHDB_USER /var/run/couchdb.pid && chmod 660 /var/run/couchdb.pid
49 su - $COUCHDB_USER -c "$command > /dev/null"
52 if [ $RETVAL -eq 0 ]; then
53 touch /var/lock/subsys/couchdb
59 msg_already_running "CouchDB"
64 if [ -f /var/lock/subsys/couchdb ]; then
65 msg_stopping "CouchDB"
67 command="$COUCHDB -d -p /var/run/couchdb.pid"
69 su - $COUCHDB_USER -c "$command > /dev/null";
72 if [ $RETVAL -eq 0 ]; then
73 rm -f /var/lock/subsys/couchdb >/dev/null 2>&1
80 msg_not_running couchdb
86 # See how we were called.
102 msg_usage "$0 {start|stop|restart|status}"