我有一个每 4 分钟运行一次的 Cron 作业脚本。在极少数情况下,脚本未在 4 分钟内完成。这会导致问题。
如何执行检查,如果前一个脚本未完成,则跳过当前运行
预期行为:
10:00 : Script A starts
10:04 : Script A2 starts - it finds that script A was not finish so this script aborts. Simply finish without doing nothing.
10:06 : Script A finish
10:08 : Script A3 starts - no other scripts running so it continue
Run Code Online (Sandbox Code Playgroud)
注意:A、A2、A3是同一个剧本(只是时间不同)!它不应该考虑可能正在运行的其他脚本
cron ×1