0

I am currently starting to work on a web server running web.py . If I understand it correctly, the whole thing is implemented as some kind of a loop that listens to the requests at the specified port and reacts accordingly.

I would like the server to perform a certain action at a certain time without a request that triggers it. What is the best way to achieve this? Thank you.

fedorSmirnov
  • 701
  • 3
  • 9
  • 19

2 Answers2

1

I think the best way is to set up a cron job in the system, which will execute your script (which can be written in Python or other language).

Tae
  • 1,665
  • 5
  • 24
  • 45
1

If you want to run it within python you can look at using the threading class.

More information on how to do it here: Executing periodic actions in Python

Community
  • 1
  • 1
Rico
  • 58,485
  • 12
  • 111
  • 141