#!/bin/sh
# description: start application at scheduled time
#
# Released under GNU GPL

# Include the functions declared in the /etc/rc.d/functions file
source /etc/rc.d/functions

# path to script to run
COUCHDB="/etc/rc.d/rc.couchdb"
# path to file storing pid
PID="/var/run/couchdb/couchdb.pid"
#server name & description
SERVER="Couchdb"

case "$1" in
        start)
                echon "Starting $SERVER............"
                $COUCHDB start
		evaluate_retval
                ;;

        stop)
                echon "Stopping $SERVER............"
                $COUCHDB stop
		evaluate_retval
                ;;

        reload)
                echon "Reloading $SERVER..........."
		pid=$(cat $PID)
		/bin/kill -SIGHUP $pid &>/dev/null
		evaluate_retval
                ;;
        restart)
                $0 stop
                /bin/sleep 1
                $0 start
                ;;
        status)
                $COUCHDB status
                ;;
        *)
                echo "Usage: $0 {start|stop|reload|restart|status}"
                exit 1
        ;;
esac

# End /etc/init.d/
