为什么我的 cron 作业执行多次? [英] why my cron job executing multiple times?
问题描述
我设置了一个需要每天执行一次的 cron 作业,但它会被执行多次.我已经按照下面提到的方式设置了它:
I have set up a cron job that need to be executed once a day but it is getting executed multiple times.I have set up it as I mentioned below:
5 8 * * * /sh_file_path
谁能告诉我为什么会发生这种情况,我应该怎么做才能解决这个问题.
Can anyone please tell me why is this happening and what should I do to resolve this problem.
推荐答案
没有更多关于您的特定设置/系统的知识,以及所有作业都被多次执行的事实,我只能推测您有多个 cron 守护进程在运行你的系统.
Without more knowledge about your particular setup/system, and the fact that all jobs get executed multiple times, I can only surmise that you have multiple cron daemons running on your system.
为cron
做一个完整的进程列表和grep(他们中的大多数在二进制文件的名称中都有这个词),看看有多少正在运行.在标准的 linux 系统上,这应该可以工作:
Do a full process list and grep for cron
(most of them have that word in the name of the binary) and see how many are running. On a standard linux system, this should work:
ps aux | grep cron
然后你必须弄清楚哪个应该运行并杀死其他人.
Then you would have to figure out which should be running and kill the others.
这篇关于为什么我的 cron 作业执行多次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!