I'm guessing that AJ's solution is the best to implement.

What I did to solve this problem is simply create a few crons on the server that each do a mechanize (http://wwwsearch.sourceforge.net/mechanize/) http call to a specific location in Zope which basically acts as a private API: when called, it executes a function that triggers whatever needs to happen. I hard-coded a check that the source IP must be the specific internal address of the server Zope runs on. That way I know that the functions can't be called from the outside.

Not the best solution, and I wouldn't really recommend it to someone else, but it's easy and it works for me.

- Thibaud

On Mon, Feb 16, 2009 at 12:50 PM, Thierry Florac <thierry.florac@onf.fr> wrote:
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@onf.fr
 Tél. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )