Periodic tasks.

Steve Howell showell30 at yahoo.com
Tue May 29 06:44:01 EDT 2007


--- Ramashish Baranwal <ramashish.lists at gmail.com>
wrote:

> Hi,
> 
> I am trying to execute some tasks periodically,
> those familiar with
> unix can think of it as equivalent to cron jobs. I
> have tried looking
> around, but couldn't find a way. Would appreciate
> any pointers or
> clues..
> 

I'm also interested in this.  On the assumption that
you can't find a cron replacement in your OS, or that
maybe you need a Python-written cron to do something a
little different than cron, these are some things to
look at:

   open(fn).readlines()
   line.split(' ', 6)
   time.sleep(), time.time() and other methods
   os.popen.readlines() (but others may disagree)

In my case I need to run jobs periodically, but before
running jobs, but I need to configure the times that
the jobs run using a database, and I need to check on
the status of the previous day's job, make sure that
I'm running on the primary box, etc.

Another technique people use is to use cron() and make
it the responsibility of the scheduled programs to
check that they should really proceed, and if there's
a chance of overlapping with a previous job that's
still running, you can use a file-locking scheme.


   


 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html



More information about the Python-list mailing list