| Version 1 (modified by vik, 4 years ago) (diff) |
|---|
To start and stop zope using your OS's init system (works on debian-style systems, YMMV on other systems), you need two files: /etc/default/zope which sets the location of the zope directory/ies, and /etc/init.d/zope, which does the starting and stopping. After copying these files, run "chmod +x /etc/init.d/zope" then "update-rc.d zope defaults"
/etc/default/zope needs at least two lines - the full path to zope(s), and the user to run as. Multiple instances are seperated by a space
# Location of zope instances (base folder); seperate by a space if you have more than one # e.g ZOPE_INSTANCES="/foo/bar/zope-dev /foo/bar/zope-production" ZOPE_INSTANCES="/opt/Plone-2.5.5/" ZOPE_USER=plone
/etc/init.d/zope shouldn't need modification; you can overwrite variables in /etc/default/zope
#! /bin/sh -e
#### BEGIN INIT INFO
# Provides: zope
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start zope instances
# Description: Debian init script for the starting zope
# instances. Basically just calls
# "zeocluster/bin/{start|shutdown|restart}cluster.sh".
### END INIT INFO
#
# Author: Victor Rajewski
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
STARTCLUSTER=zeocluster/bin/startcluster.sh
STOPCLUSTER=zeocluster/bin/shutdowncluster.sh
RESTARTCLUSTER=zeocluster/bin/restartcluster.sh
# Configuration file for zope instances. Seperate instances by a space
# At miniumum should have:
#
# ZOPE_INSTANCES="/opt/Plone-2.5.5/"
# ZOPE_RUN_AS=plone
#
conf="/etc/default/zope"
# Exit if not found.
test -f "$conf" && . "$conf"
. /lib/lsb/init-functions
for instance in $ZOPE_INSTANCES ; do
cmd="su $ZOPE_RUN_AS -c '$instance'"
RETVAL=0
case "$1" in
start)
log_daemon_msg "Starting: $instance"
echo -n " "
eval $cmd/$STARTCLUSTER
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping: $instance"
echo -n " "
eval $cmd/$STOPCLUSTER
log_end_msg 0
;;
restart)
log_daemon_msg "Restarting: $instance"
echo -n " "
eval $cmd/$RESTARTCLUSTER
log_end_msg 0
;;
*)
echo "Usage: /etc/init.d/zope {start|stop|restart}"
exit 1
;;
esac
done
