[Zope] Periodic task in a Zope 2 environment

Thierry Florac thierry.florac at onf.fr
Mon Feb 16 12:50:02 EST 2009


Le lundi 16 février 2009 à 16:59 +0100, Marco Bizzarri a écrit :
> Hi all.
> 
> A little of background, before.
> 
> I need to run some tasks, inside a zope environment, in a periodic
> way. Even though I could resort to using cron and wget, I do not like
> the solution too much, also because it requires me to rely on
> something completly external to the application to schedule the task
> itsel (I need to update the cron to change how often a job is run...
> ).
> 
> 
> Now, I can see I can run a task using zopectl run + a script. My
> script would therefore be something like:
> 
> while True:
>      do something
>      sleep(for sometime)
> 
> 
> of course, there are dozen of ways to write this in a better way, but
> that is not the problem. My problem is understanding if it is possible
> to run such a script via the zdaemon. Can anyone shred some light on
> this topic?


Hi,

I don't know if it's the best way, but I've implemented a "cron like"
task base class for my Zope-2.9 instance, which :
 - is thread based
 - can launch operations in a "cron like" way
 - can act as the user of your choice.

It doesn't actually provide any user interface to define task
scheduling, but the main base class could probably be used as a good
starting point ; at least, it works ;-).
I can send you the source code on request...


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.florac at onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85



More information about the Zope mailing list