I have a python program and I want to keep it running every hour, but sometimes previous…
- User
I have a python program and I want to keep it running every hour, but sometimes previous run takes more than one hour, how to correctly schedule in a MacOS/linux and also I want to see the program output (logs)
Assistant
Here are a few options to schedule your Python program to run every hour and handle cases where the previous run takes longer than an hour:
- Use cron:
0 * * * * /path/to/python /path/to/script.py > /path/to/logfile 2>&1This will run the script on the 0th minute of every hour. If a previous run is still running, cron will skip the next run.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.