Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9478
| References | <c626a2fe-3379-41cb-88d8-4f7495d537e6@d1g2000yqm.googlegroups.com> <mailman.810.1310259664.1164.python-list@python.org> <54735121-6a94-4dcb-9f6b-e4fca4aad652@u42g2000yqm.googlegroups.com> <6uidnYUoaNs-vYLTnZ2dnUVZ_sidnZ2d@insightbb.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2011-07-14 11:13 -0600 |
| Subject | Re: How can I make a program automatically run once per day? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1030.1310663668.1164.python-list@python.org> (permalink) |
On Thu, Jul 14, 2011 at 11:00 AM, monkeys paw <monkey@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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How can I make a program automatically run once per day? John Salerno <johnjsal@gmail.com> - 2011-07-09 17:26 -0700
Re: How can I make a program automatically run once per day? Ben Finney <ben+python@benfinney.id.au> - 2011-07-10 10:40 +1000
Re: How can I make a program automatically run once per day? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-09 19:49 -0500
Re: How can I make a program automatically run once per day? Alexander Kapps <alex.kapps@web.de> - 2011-07-10 03:00 +0200
Re: How can I make a program automatically run once per day? John Salerno <johnjsal@gmail.com> - 2011-07-09 19:01 -0700
Re: How can I make a program automatically run once per day? Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2011-07-10 10:49 +0200
Re: How can I make a program automatically run once per day? monkeys paw <monkey@joemoney.net> - 2011-07-14 13:00 -0400
Re: How can I make a program automatically run once per day? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-14 11:13 -0600
Re: How can I make a program automatically run once per day? baloan <baloand@googlemail.com> - 2011-07-27 01:41 -0700
Re: How can I make a program automatically run once per day? John Salerno <johnjsal@gmail.com> - 2011-07-26 18:05 -0700
Re: How can I make a program automatically run once per day? Ethan Furman <ethan@stoneleaf.us> - 2011-07-26 19:02 -0700
Re: How can I make a program automatically run once per day? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-26 21:22 -0500
Re: How can I make a program automatically run once per day? John Salerno <johnjsal@gmail.com> - 2011-07-26 21:09 -0700
Re: How can I make a program automatically run once per day? Chris Angelico <rosuav@gmail.com> - 2011-07-27 16:55 +1000
Re: How can I make a program automatically run once per day? Dave Angel <davea@ieee.org> - 2011-07-27 08:27 -0400
Re: How can I make a program automatically run once per day? Chris Angelico <rosuav@gmail.com> - 2011-07-27 22:35 +1000
Re: How can I make a program automatically run once per day? Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-27 08:58 -0400
Re: How can I make a program automatically run once per day? John Salerno <johnjsal@gmail.com> - 2011-07-27 09:03 -0700
Re: How can I make a program automatically run once per day? Paul Rudin <paul.nospam@rudin.co.uk> - 2011-07-10 11:21 +0100
csiph-web