3 # couchdb apache couchdb init script
7 # description: apache couchdb init script
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
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
46 test -n $COUCHDB_PID \
47 && touch $COUCHDB_PID \
48 && chown $COUCHDB_USER $COUCHDB_PID
49 daemon --user $COUCHDB_USER /usr/bin/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
66 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
79 killproc --pidfile $COUCHDB_PID couchdb -HUP
84 if [ ! -f /var/lock/subsys/couchdb ]; then
85 msg_not_running couchdb
95 # See how we were called.
110 # include force-reload here if program allows reloading without restart
111 # otherwise remove reload action and support force-reload as restart if running
115 # use this one if program doesn't support reloading without restart
124 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"