cron with sched module
glenfant at equod.com.nospam
Mon Dec 18 16:11:48 CET 2000
It's what I've finally done. It's easy and meets what I need.
The "sched" module is definitely stupid: the "run" method is blocking and
there's no way to add new events to a running sched object.
Or did I miss something.
"Andreas Jung" <andreas at andreas-jung.com> a écrit dans le message news:
mailman.977141221.13933.python-list at python.org...
> 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
> > executed evry 15 seconds. Launching Python executable periodically such
> > manner will eat the disk I/O and
> > So, I'm trying with the "sched" module to do this but I can't add
> > 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.
More information about the Python-list