On Thu, Jul 14, 2011 at 11:00 AM, monkeys paw <mon...@joemoney.net> wrote:
> You could use the below code. time.sleep(# seconds in a day)
> where i == 30 would run once a day for a month
>
> import time
> i=0
> while (1):
>        print 'hello'
>        time.sleep(2)   # Change this to number of seconds in a day
>        if (i == 3):    # make this 30 for a month
>                break
>        i = i + 1

If the system ever gets rebooted during that month, then you would
need to remember to manually restart the script.  Or if the effective
part of the script raises an exception, it could crash the whole
script without some defensive coding.  That's why it's better just to
use the system scheduler service.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to