Assuming a script fails and it is captured in a try catch how to run a python script again after a few days?
I can use sleep
on this problem, but I think it will not work due to the fact that the server restarts every day. What is the best solution on this problem?
Advertisement
Answer
Typically you want to address this with a cron job.
I would probably do the following:
- When the python file runs, save a log file with the status date/time.
- Set up a cron job on the server to check, say once every 24 hours, that checks that log file and either do nothing or runs the python file again.