Search code examples
pythonschedulingjobsscheduler

Schedule script execution after fixed time?


I have a Python script that can run anywhere from 10 seconds to 5 minutes.

I need a scheduler that can spawn the job, then after the job is finished, wait 15 minutes, then run the job again etc.

  • No concurrency, just one instance of the job.
  • After the job is finished (not started!) there must be a wait period of 15 minutes.
  • Linux machine.

Solution

  • You could use a bash script to do that. Invoke the program then after it finishes sleep for 15 minutes.

    while true; do
        python myprogram.py
        sleep 900
    done