Skip to main content

Automatically Pack The ZODB

January 3, 2009
  • Add Products.ClockServer to your egg section in buildout.cfg
  • Add something like this in your instance section
    zope-conf-additional = 
        <clock-server>
          method /pack_it_all
          period 86400
          user admin
          password password
          host localhost
       </clock-server>  
    
  • Re-run buildout
  • Start server
  • In the root of zope, create a "Script(Python)" with the id of "pack_it_all"
  • To the contents, add something like this,
    dbs=context.Control_Panel.Database
    names = dbs.getDatabaseNames()
    
    for name in names:
      if name != 'temporary':
        dbs[name].manage_pack(days=3)
        print "packed %s" % name
    
    return printed
  • This will pack all the databases you have in Zope once a day