#!/bin/sh
# Zope zopectl script, from:
# http://www.zope.org/Members/jonms/MacOSXService

ZOPEHOME=%%ZOPEBASE%%
PATH=.:$PATH

case "$1" in
	start)
		echo -n "Starting Zope"
		$ZOPEHOME/start -u %%ZOPEUSER%% -p %%CGIBINDIR%%/Zope.cgi \
            >> $ZOPEHOME/var/error.log 2>&1 &
		echo ".  Please wait a few moments for Zope to fully start."
		;;
	stop)
		echo -n "Stopping Zope"
		$ZOPEHOME/stop && rm -f $ZOPEHOME/var/pcgi.pid \
		$ZOPEHOME/var/pcgi.soc
		echo ".  Please wait a few moments for Zope to fully stop."
		;;
	restart)
		$0 stop
		sleep 3
		$0 start
		;;
	reload)
		$0 restart
		;;
	*)
		echo "Usage: zopectl [start|stop|restart|reload]"
		exit 1
		;;
esac

exit 0
