[Zope] sysv init script for Zope 2

Alex Rice alrice@swcp.com
Mon, 31 May 1999 17:45:33 -0600 (MDT)


Here is an init script for Zope2/ZServer. Folks might find it useful
just as a wrapper around z2.py. That's how I'm using it.

On Redhat Linux, the init scripts are kind of covoluted-- I'm still not
sure how it handles killing daemons. If you are comfortable with
Redhat's init scripts, try putting a symlink to this script in
/etc/rc.d/rc5.d/.

#!/bin/sh

#
# Init script for the Zope2 application server (using ZServer)
#

# Alex Rice <alex@mindlube.com>

# notes:
# o don't put this in /etc/rc.d/rcX.d/ unless you know what you are doing
# o format copied from other Redhat 6 init scripts
# o make sure your network interface is up before you start zope!

# adjust these as appropriate
ZOPE_BASE=/usr/share/zope
PYTHON=/usr/local/bin/python
# there better way to get DNS server (like from /etc/resolv.conf) anyways...
# put your DNS server here:
NS=127.0.0.1

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Zope: "
	$PYTHON $ZOPE_BASE/z2.py -d $NS &
	echo
	;;
  stop)
	echo -n "Shutting down zope: "
	$PYTHON $ZOPE_BASE/lib/python/ZPublisher/Client.py \
	        -u ` cat $ZOPE_BASE/access ` \
		http://localhost:9673/Control_Panel/manage_shutdown  \
		> /dev/null 2>&1
	echo
	;;
  status)
	echo "Status of Zope: "
	echo "<this feature not yet implemented>"
	;;
  restart)
	echo -n "Restarting zope: "
	$PYTHON $ZOPE_BASE/lib/python/ZPublisher/Client.py \
	        -u ` cat $ZOPE_BASE/access ` \
		http://localhost:9673/Control_Panel/manage_restart
	echo
	;;
  reload)
	echo -n "Reloading zope: "
	$PYTHON $ZOPE_BASE/lib/python/ZPublisher/Client.py \
	        -u ` cat $ZOPE_BASE/access ` \
		http://localhost:9673/Control_Panel/manage_restart
	echo
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 1
esac

exit 0