Hello Guys,

 

I've got a method in my app that I want to run every 20 minutes that the
application it running, what's the best way of achieving this? At the moment
I'm using this kind of method.

 

import sched

import time, sys

scheduler = sched.scheduler(time.time, time.sleep)

 

scheduler.enter(1.0, 0, sys.stdout.write, ("one\n",))

scheduler.run()

 

Now when the function runs after 20 minutes I just have it schedule itself
to run again in 20 minutes time, which seems to work for me quite nicely, it
just seems a little 'hacky' to keep the task reoccurring like that.

 

Is there any other method? I've spent some time on Google but couldn't
really find anything. Not sure if it makes any difference but I'm running
Linux.

 

Thanks,

 

Rob

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to