cron with sched module

Andreas Jung andreas at andreas-jung.com
Mon Dec 18 07:05:46 EST 2000


On Fri, Dec 15, 2000 at 05:26:33PM +0100, Gilles Lenfant wrote:
> I'm trying hardly to make a python "cron" like utility that may run
> functions/methods periodically (say every x seconds) and predetermined
> hours.
> 
> I can't use Window "AT" or Unix "cron" cause some functions/methods must be
> executed evry 15 seconds. Launching Python executable periodically such a
> manner will eat the disk I/O and
> 
> So, I'm trying with the "sched" module to do this but I can't add  "enter"
> to a scheduler object already running.
> So, what's the workaround ?
> Use directly lower level "threading" module in lace of sched ?

I suggest to use the thread or threading module. The threading
provides a higher level interface (it's build on the top
of the thread module). The way how to implement a solution for
your needs depends on your needs. E.g. you can create a worker
threads that runs in a loop. To periodic execution you could
use time.sleep() to delay execution for a period of time.

Andreas 




More information about the Python-list mailing list