time - Check a log file every 15 minutes with Python -


i trying open log file every 15 minutes , see if file called 'finalize' string. know how check file string not know if there easy way have script every 15 minutes.

is there module of sort allow me this?

[edit] want because writing queue program. once 1 job calls finalize, script load job , monitor until finishes, etc.

the sched module let this. timer class in threading module.

however, either of overkill want.

the easy, , best, way use system's scheduler (scheduled tasks on windows, launch services on mac, cron or related program on other systems) run program every 15 minutes.

alternatively, use time.sleep(15*60), , check whether time.time() 15*60 seconds later last time through loop.


one advantage of triggering script outside makes easy change trigger. example, change trigger every time file has been modified, instead of every 15 minutes, without changing script @ all. (the exact way that, of course, depends on platform; launchservices, famd, inotify, findfirstchangenotification, etc. work differently. every modern platform has way it.)


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -