You are not logged in Log in Join
You are here: Home » Members » vernier » Debian » ZopeRestart » wikipage_view

Log in
Name

Password

 
 
FrontPage » WebLog »

ZopeRestart

A Zope Restart Method for Debian and Zeo

The Problem: default setup of debian zope causes problems if I install ZEO

  • Gregor Hoffleit, the Debian maintainer of zope, recommends /etc/init.d/zope stop then /etc/init.d/zope start for hard restarts and zopectl restart for soft restarts .
  • Chris Gray explains how to setup ZEO on debian (see resources below) but stops short of offering a clean setup for un-attended reboots
  • I notice I sometimes need to kill some remaining zope -z2, zopectl or pcgi-wrapper processes between those two hard restart commands
  • ZEO process has to be run first before zope is started
  • idea: put zeo startup in /etc/init.d/zope start and zeo stop in /etc/init.d/zope stop ; this way it will be the hard restart of zope (including zeo) as opposed to zopectl, the soft restart of zope only (not zeo)

Solution: This works for my needs and wishes expressed here. It is brutish because I want it to work for un-attended zope and zeo restarts. Add the following to /etc/init.d/zope:

 case $1 in
  stop )
   echo Stopping ZEO
   zopectl stop
   sleep 1
   kill $(cat /var/lib/zope/var/ZEO_SERVER.pid) 
   rm  -f /var/lib/zope/var/*.lock # in case locks are left hanging
   for I in $(ps ax |grep python|grep zope|cut -d" " -f1)
    do kill -HUP $I   # to kill off any remaining zope processes
   done
   killall -9 zopectl  # kill any remaining hanging zopectl processes
   killall -9 zope-z2  # kill any recalcitrant zope processes
   ;;
  start )
   echo Starting ZEO
   cd /var/lib/zope/var
   export STUPID_LOG_FILE=/tmp/stupid.log  # debug logging
   mv /tmp/stupid.log /tmp/stupid2.log  # primitive rotating
   # this is the only line that really matters:
   python /usr/lib/zope/lib/python/ZEO/start.py -d -p 7700 -u www-data
   cd -
   ;;
  esac
  # rest of zope restart script continues here

Notes:

  • probably not a good idea to use the -D (show debug and don't go int0 background flag) ... instead use export Z_DEBUG_MODE=1 just before restart the zope process when you want to see complete debugging output on the console

Resources

.