Running a python code periodically

Terry Reedy tjreedy at udel.edu
Thu May 8 16:31:31 EDT 2008


"Maryam Saeedi" <ma.saeedi at gmail.com> wrote in message 
news:ee9cd3be0805080902g48e641bxbcf1d5578620defe at mail.gmail.com...
|I was wondering if you know how can I run a python code once every five
| minutes for a period of time either using python or some other program 
like
| a bash script.

I expect the following should work.

from time import sleep
while True: #or
# for i in range(nunber_of_cycles):
  do_whatever()
  sleep(600)

assuming do_whatever() is quick and you do not need exactly 5 minute 
intervals.


| I have asked this question before and some of you answered me but I still
| have problem. Most of the answers was to use cron and crontab which works 
on
| my computer but not if I want to do it on department's computer since I 
do
| not have permission to change those files. Is there any other way which 
does
| not need administrator permission?






More information about the Python-list mailing list