-4

How can I run a python definition now, but do more stuff after a certain time. So it's kind of running the script silently in the background until certain condition is met?

Thank you

cloud68
  • 23
  • 1
  • 6
  • when the time is pass midnite, for example? – cloud68 Jul 31 '12 at 04:59
  • 2
    cron it on linux, schedule it on Windows [control panel > scheduled tasks > Add scheduled task] You may also be interested to have a look at http://code.activestate.com/recipes/551780/ – verisimilitude Jul 31 '12 at 05:01
  • if you want to run this "def" while you code is running (ie, in the background of your own code), you should look for a mult-thread code. if you want to execute your whole application after some time you should consider @verisimilitude comment. – Gustavo Vargas Jul 31 '12 at 05:03
  • thank you all. I'll try scheduled task – cloud68 Jul 31 '12 at 05:06
  • You could even use the `&` operator to shell-execute it in the background. – verisimilitude Jul 31 '12 at 05:07

1 Answers1

2

You can use cron job to execute a python script at a certain time. You can find a similar answer here. If you looking for a pure python implementation, this answer will help.

Community
  • 1
  • 1
jerrymouse
  • 16,964
  • 16
  • 76
  • 97