0

Possible Duplicate:
What is the best way to repeatedly execute a function every x seconds in Python?

I would like to get system information using SMNT protocol and I would like to refresh this data every 30 seconds. My idea is to run a thread and after getting the data call the sleep function. Is there any other way. for example a built in function which run a given function each 30 seconds in the background?

Community
  • 1
  • 1
Mokus
  • 10,174
  • 18
  • 80
  • 122
  • 1
    The accepted answer of [This SO Question](http://stackoverflow.com/questions/474528/what-is-the-best-way-to-repeatedly-execute-a-function-every-x-seconds-in-python) should help you which suggests the [shecd](http://docs.python.org/library/sched.html) module. – Tariq M Nasim Jul 17 '12 at 11:13

1 Answers1

1

Take a look at the event scheduler. You could schedule a function to be called every 30 seconds, and once called, it could add itself back into the cue to be called in another 30 seconds.

Also, this post may be of some use to you.

Community
  • 1
  • 1
Pep_8_Guardiola
  • 5,002
  • 1
  • 24
  • 35