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

ZOPEDIR=%%DPPATH%%
PATH=.:$PATH

case "$1" in
	start)
		echo -n "Starting Zope"
		cd $ZOPEDIR
		$ZOPEDIR/start > var/error.log 2>&1 &
		echo ".  Please wait a few moments for Zope to fully start."
		;;
	stop)
		echo -n "Stopping Zope"
		cd $ZOPEDIR
		$ZOPEDIR/stop > var/error.log 2>&1 &
		rm -f var/pcgi.pid 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
