File couchdb.init of Package couchdb

#!/bin/sh
#
# couchdb This is the init script for starting up the CouchDB server
#
# chkconfig: - 20 80
# description: Starts and stops the CouchDB daemon that handles \
#	       all database requests.

### BEGIN INIT INFO
# Provides: couchdb
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: start and stop CouchDB database server
# Description: Apache CouchDB is a distributed, fault-tolerant and 
#              schema-free document-oriented database accessible 
#              via a RESTful HTTP/JSON API
### END INIT INFO

# Source function library.
. /etc/rc.status

rc_reset

COUCHDB_BIN="/usr/bin/couchdb"
config="/etc/sysconfig/couchdb"

[ -e $config ] && . $config

lockfile=/var/lock/subsys/couchdb


case "$1" in
    start)
	echo -n "Starting CouchDB"
	sudo -u couchdb $COUCHDB_BIN -b -o /var/log/couchdb/couchdb.stdout -e /var/log/couchdb/couchdb.stderr >  /dev/null 2>&1
        rc_status -v
        ;;
    stop)
	echo -n "Stopping CouchDB"
	sudo -u couchdb $COUCHDB_BIN -d > /dev/null 2>&1
        rc_status -v
        ;;
    restart|force-reload)
	$0 stop
	$0 start
	rc_status
        ;;
    status)
	echo -n "Checking for CouchDB"
	sudo -u  couchdb $COUCHDB_BIN -s > /dev/null 2>&1 || rc_failed 3
	rc_status -v
        ;;
    condrestart|try-restart)
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac
rc_exit
openSUSE Build Service is sponsored by