#!/bin/sh
# RedHat startup script for a Zope instance using zopectl
#
# chkconfig: 2345 80 20
# description: Zope, the web application server

# Source function library.
. /etc/rc.d/init.d/functions

zopectl="/usr/bin/zopectl-erp5"
name="zope"

[ -f $zopectl ] || exit 1

RETVAL=0

start() {
    gprintf "Starting %s: " "$name" 
    "$zopectl" start
    RETVAL=$?
    echo
    return $RETVAL
}

stop() {
    gprintf "Stopping %s: " "$name" 
    "$zopectl" stop
    RETVAL=$?
    echo
    return $RETVAL
}

case "$1" in
	start)
	    start
	    ;;
	
	stop)
	    stop
	    ;;
	
	restart)
	    stop
	    start
	    ;;
	
	*)
	    gprintf "Usage: %s {start|stop|restart}\n" "$0"
	    exit 1

esac

exit $REVAL
