Cron作业运行超过时间间隔 [英] Cron job running beyond interval

查看:124
本文介绍了Cron作业运行超过时间间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您配置cron作业,每分钟运行一次。如果实际任务运行超过一分钟,会发生什么? cron会创建另一个作业实例/线程吗?

解决方案

$ c
$ b

你必须处理这种情况,不能确定linux会优雅地处理它。通过在运行任务之前添加一个简单的检查,任务尚未运行。



这篇文章会帮助你仅当cron作业尚未运行时才运行cron作业


Say you configure a cron job to run every minute to do something. What will happen if the actual task runs longer than a minute? Will cron create another job instance/thread? Or will cron wait and make sure the previous run is complete?

Thanks!

解决方案

You must handle that scenario, not sure linux will handle it gracefully. By adding a simple check before running your task that the task is not already running. If you don't do that, hell will probably break loose on your server.

This post will help you Run cron job only if it isn't already running

这篇关于Cron作业运行超过时间间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆