Another milestone on the road to Zen with Ingeniweb components
Latest version : 1.4.2

Maintenance for Plone

> Run scheduled scripts for routine work in a Plone site, like packing the ZODB. <

About Maintenance for Plone

Run scheduled scripts for routine work in a Plone site, like packing the ZODB.

Maintenance for Plone has been designed by the INGENIWEB team.

Maintenance for Plone 1.4.2 is licensed under the GNU GPL license.

Do you like this product? You can support its authors by clicking the button below:
Support This Project


Coming later !



PloneMaintenance consists of a portal_maintenance tool that allows you to define maintenance tasks and scripts to run according to a schedule assigned to the tasks.

No task is going to be run unless it is scheduled to. The schedule information is stored in the task, and even if PloneMaintenance is called many times in a row, it will always look up the schedule information, check when was the last time the task was run, calculate the next time the task is scheduled to run, and depending on this, PloneMaintenance will decide whether it runs the script associated to the task or not.

PloneMaintenance depends on an external tool to wake it up and make it execute the scheduled tasks. Without an external tool, PloneMaintenance will just sit and wait, doing nothing. You can go to the portal_maintenance tool and manually run the maintenance tasks, but most of the time, you want an external tool doing the job automatically.

You can choose one of the Schedulers which are available for Zope, or call PloneMaintenance from a cron job.

Zope 2.6: *

Zope 2.7: * *

Hint on timerservice installation under windows

This product installation requires to compile a python module. This compilation do not need to Visual C++ being installed. You just need to compile the module with the python used for your Plone installation. Go in $PloneProductsTimerServicetimerserverand run:

"C:Program FilesPlone-2.xZopebinpython.exe" install

Now windows didn't link correctly your module. You have to copy/paste the module in "C:Program FilesPlone-2.xZopelibpython".

Setup runMaintenanceTasks script

All the schedulers have to do is call the runMaintenanceTasks Python Script that will take care of calling the runTasks method of the portal_maintenance tool. The runMaintenanceTasks script can be run by an anonymous user, because the PloneMaintenance tool makes sure to only run tasks that need to be run.

Another way of calling PloneMaintenance is by an unix cron job. All you need to do is to call every once in a while. Have a look at the following Howto on

Run cron jobs to do things automatically

How PloneMaintenance works

When the PloneMaintenance tool is called, it locks itself using the _v_running variable. The next time a schedule is started, this lock will prevent the execution of the Tasks so that tasks that take a long time to execute are protected.

When a Task is created, an initial execution time is stored, although this does not mean we start the Task right away.

The PloneMaintenance tool executes one Task after the other, always storing the execution date. At the end, the lock is removed.

PloneMaintenance computes the next execution time given the current date and compares it to the next execution date, given the last execution date. If the two calculated dates are the same, it does nothing, otherwise it runs the task.

Tasks are added to the portal_maintenance tool. They have a "script_name" property that names the script which they execute, and they have a "last_execution_date", which stores the last time the task was executed.

Scripts are also added to the portal_maintenance tool. They can be normal Python Scripts.

Here is an example of a Maintenance Script for a Plone site:

# Script for packing the ZODB:
# (Already integrated into PloneMaintenance)

if 'main' in dbs.getDatabaseNames():


Install PloneMaintenance from the Plone Configlet or using the QuickInstaller.

Note : Once you have an instance of the PloneMaintenanceTool, you should avoid uninstalling PloneMaintenance, otherwise you will lose any custom scripts and tasks.


Released versions

Released versions of Maintenance for Plone are available here. The current version is 1.4.2.

CVS version

The repository contains the up-to-date versions of our source code. In order to get the HEAD branch of PloneMaintenance, use :

svn co

You can also browse the CVS with your browser.



Please take time the read the Readme


Using ZopeScheduler and TimerService

  1. unarchive these products in $INSTANCE/Products

2) Edit TimerService/timerserver/component.xml and move ten minutes interval to one :

<key name="interval" datatype="integer" default="600">

Will become :

<key name="interval" datatype="integer" default="60">
  1. Go in TimerService/timerserver and launch python2.3 install

4) For Windows administrators, copy $PYTHON_LIB/site-packages/timerserver in $ZOPE/lib/python

  1. Restart Zope

You will see something like that in event logs:

2005-11-04T08:39:44 INFO ZServer Timer server started at Fri Nov 4 08:39:44 2005
Interval: 60 seconds.



Maintenance for Plone changes

1.4.2 2007/08/30

  • Fixed end of month computation

1.4.1 2006/11/03

  • Does'nt break ZMI if resqueted schedulong gives an impossible date: for example 11/31 or 2006/02/29

1.4 2006/07/13

  • Fix bug on MaintenanceTask: id was not initialized
  • Add "notified_emails" property. When a task has been processed, an email is sent.
  • MaintenanceTask no more addable types 2006/07/06 MR

1.3 2006/05/31

  • Handle force parameter 2006/05/31 MR
  • Set last execution date when script fails 2006/05/19 MR
  • Fix end of month is not the 31 bug

1.2 2006/01/24

  • Allow to run debug mode with a debug.txt file in the product 2005/11/07 ED
  • Code cleaning 2005/11/07 ED

1.1 2005/10/05

  • Don't allow tasks to be added globally. 2005/10/04 MR
  • Added "Select a script" to task drop down. A user could get the impression that a script was selected although he never chose one. 2005/09/29 MR
  • Added some more logs
  • Added and tested a script that allows updating the portal_catalog.
  • Added, tested and improved a script that allows archiving the Plone site's expired content. 2005/09/15

1.0 2005/09/01

  • Improved the (allow reinstall without an error, code cleanup, etc)
  • More importantly, fixed a bug with the rebuildCatalogs script not applying to the right context (i.e. the Plone site root). In the future, we should investigate replacing External Methods with tool-based helper methods or Zope 3 views/adapters.
  • Add proxy role manager to runMaintenanceTasks script 2005/08/31
  • Fixed problem for Plone 2.1 compatibility in and 2005/08/31
  • Integrated "Rebuild Catalogs in a PloneArticle-aware way" script as an external method 2005/08/31
  • Integrated "Pack ZODB" script as an external method 2005/08/31
  • Reporting when scripts fail to run 2005/03/27
  • Removed dependency on navigation_properties and form_properties (Plone 2.1) 2005/03/27
  • runTasks returns a description of what was done 2005/03/15
  • Added link for running maintenance tasks directly in maintenance tool 2005/03/15
  • Added runMaintenanceTasks Python Script. Changed Readme to explain how to call this script. 2005/03/11

0.3.2 2004/07/27

  • Showing last execution time as well
  • Last execution time is now correctly stored upon task execution

0.3.1 2004/07/05

  • Removed bogus imports - product was broken if ZAttachmentAttribute was not installed.
  • Fixed Readme: Of course portal_maintenance/runTasks should be called, and not plone_maintenance/runTasks.

0.3.0 2004/05/17

  • The algorithm used to calculate the next execution date was simplified and refactored

0.2.3 2004/05/15

  • Adding Maintenance scripts in doc/maintenance_scripts.txt:
    • Pack DB
    • Update Catalog

0.2.2 2004/04/26

  • Removing seconds from DateTimes as they don't play a role

0.2.1 2004/04/25

  • Made sure that runMaintenanceTasks can be run by Anonymous
  • Show scheduled tasks in Overview

0.2 2004/04/25 Maik Rder

  • rewrote getNextScheduledExecutionTime
  • Show warning in the Overview tab when no schedulers are installed
  • Explain quickly where to look for info on installing a scheduler
  • Explanation on the different ways of running PloneMaintenance
  • adapted unit tests and wrote some
  • added skin

0.1.1 2004/04/21 Maik Rder

  • Log entries at the important points
    • runTasks
    • runTask
  • replaced _v_execution_date by execution_date

0.1 - 2004/04/19 Maik Rder

  • Initial version
  • Create a scripts folder for our scripts
  • Show selection list for the existing scripts
  • Scripts and Tasks come in their own folder.
  • Added Tabs for these folders.
  • Added Overview Tab
  • Scripts can be added to Tasks with drop-down list
  • Tested running Tasks

Maintenance for Plone ChangeLog is also available for detailed informations.