Search code examples
cronplonezopepackzodb

What is the suggested way to cron-automate ZODB packs for a production Plone instance?


Looking at plone.org to find a way to periodically pack my instance's ZODB I could only find http://plone.org/documentation/faq/how-do-i-pack-the-zodb that doesn't talk about automated packs, but just manually initiated ones.

I know I can simulate the manual pack with wget or curl, but I'd like to know if that is the best practice in use for production sites.


Solution

  • If you are using ZEO you can add the following to your Crontab to do this:

    0 1 * * 6 <path-to-buildout>/bin/zeopack
    

    If you don't want to do it manually, add this to your buildout.cfg and the crontab entry above will be added automatically when you run bin/buildout:

    parts += crontab_zeopack
    
    # pack your ZODB each Sunday morning and hence make it smaller and faster
    [crontab_zeopack]
    recipe = z3c.recipe.usercrontab
    times = 0 1 * * 6
    command = ${buildout:directory}/bin/zeopack