Running python script with cron only if not running

后端 未结 4 1636
自闭症患者
自闭症患者 2020-12-25 14:45

I need to run a python script (job.py) every minute. This script must not be started if it is already running. Its execution time can be between 10 seconds and several hours

4条回答
  •  感情败类
    2020-12-25 14:52

    You can use The Fat Controller which is a daemon that will restart a script x seconds after the previous instance finished, so you can never have overlapping instances of the same script.

    You can even tune it to start an instance immediately afterwards if a certain condition is met.

    (I'm afraid the website is a bit basic, but the project is stable and is running on at last several websites that I know of. I will make a nice, pretty website once I get v0.0.3 out the door!)

提交回复
热议问题