Autostart Zope on Ubuntu
From the Looking-over-the-Fence Department
As part of a current gig I today had to set up two spanking new Ubuntu based servers and deploy a Plone application that I've developed. One task was to have the Plone application start up automatically at boot time. Being a FreeBSD person I had to adapt a bit. In the end I just mashed this init.d how-to with my own homegrown FreeBSD rc.d script and created the following shell script in /etc/init.d/zope.sh:
#!/bin/bash
INSTANCESDIR="/opt/zope/instances"
SUDO=`which sudo`
for instance in `ls $INSTANCESDIR/` ; do
$SUDO -u www-data $INSTANCESDIR/$instance/bin/zeoserver "$@"
sleep 5
$SUDO -u www-data $INSTANCESDIR/$instance/bin/deployment "$@"
done
and issued the following two commands (as root):
update-rc.d zope.sh defaults
chmod a+x /etc/init.d/zope.sh
This ensures that all zope instances in $INSTANCESDIR get started at boot time (and properly shut down at shutdown time!) As you can see, I run a ZEO based setup with a deployment buildout, so, as usual, your mileage may vary etc.
