Run cron job only if it isn't already running

后端 未结 16 936
执笔经年
执笔经年 2020-11-29 14:53

I\'m trying to set up a cron job as a sort of watchdog for a daemon that I\'ve created. If the daemon errors out and fails, I want the cron job to periodically restart it...

16条回答
  •  情歌与酒
    2020-11-29 15:36

    Docs: https://www.timkay.com/solo/

    solo is a very simple script (10 lines) that prevents a program from running more than one copy at a time. It is useful with cron to make sure that a job doesn't run before a previous one has finished.

    Example

    * * * * * solo -port=3801 ./job.pl blah blah
    

提交回复
热议问题