3 # couchdb Starts CouchDB
4 # chkconfig: 2345 84 25
5 # description: Apache CouchDB init script
6 # pidfile: /var/run/couchdb.pid
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
17 COUCHDB="/usr/bin/couchdb"
18 COUCHDB_INI='/etc/apache-couchdb/couch.ini'
19 COUCHDB_PID='/var/run/couchdb.pid'
20 COUCHDB_USER='couchdb'
21 COUCHDB_STDOUT='/dev/null'
22 COUCHDB_STDERR='/dev/null'
25 # Get service config - may override defaults
26 [ -f /etc/sysconfig/couchdb ] && . /etc/sysconfig/couchdb
28 # Check that networking is up.
29 if is_yes "${NETWORKING}"; then
30 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
31 msg_network_down "CouchDB"
39 # Check if the service is already running?
40 if [ -f /var/lock/subsys/couchdb ]; then
41 msg_already_running "CouchDB"
45 msg_starting "CouchDB"
46 test -n $COUCHDB_PID \
47 && touch $COUCHDB_PID \
48 && chown $COUCHDB_USER $COUCHDB_PID
49 daemon --user $COUCHDB_USER $COUCHDB \
50 -b -c "$COUCHDB_INI" -p "$COUCHDB_PID" \
51 -o "$COUCHDB_STDOUT" -e "$COUCHDB_STDERR" \
54 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/couchdb
58 if [ ! -f /var/lock/subsys/couchdb ]; then
59 msg_not_running "CouchDB"
64 msg_stopping "CouchDB"
65 killproc --pidfile $COUCHDB_PID couchdb -TERM
67 rm -f /var/lock/subsys/couchdb
71 if [ ! -f /var/lock/subsys/couchdb ]; then
72 msg_not_running "CouchDB"
77 msg_reloading "CouchDB"
78 killproc --pidfile $COUCHDB_PID couchdb -HUP
83 if [ ! -f /var/lock/subsys/couchdb ]; then
84 msg_not_running "CouchDB"
94 # See how we were called.
117 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"