为什么这个 cron 条目会执行两次? [英] Why is this cron entry executed twice?
本文介绍了为什么这个 cron 条目会执行两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
*/5 * * * * my command
此条目有效,但每 5 分钟执行两次,为什么?
This entry works but every 5 minutes it gets executed twice, why?
在 /var/log/cron
中显示:
Jun 16 22:20:01 Test CROND[12512]: (root) CMD (my command)
Jun 16 22:20:01 Test CROND[12516]: (root) CMD (my command)
所以不是来自两个用户.
So it's not from two users.
使用crontab -e -u root
只输入一次.该命令是一个php命令.
It is only entered once with crontab -e -u root
. The command is a php command.
推荐答案
描述中没有给出执行两次的理由.看看别处.
Nothing in the description gives reason for it to be executed twice. Look elsewhere.
- 是否有两个用户调用它?
- 是否输入了两次?
- 它会调用自己吗?
- 它是否设置了重复的运动条件?
如果它是您正在执行的 shell 脚本,请将 whoami
和 date
附加到日志文件中.你应该能找出原因.
If it's a shell script you're executing, have it append whoami
and date
to a log file. You should be able to dig up the reason.
输入 ps -A |grep crond
,确保 crond 没有运行两次.
Type ps -A | grep crond
, make sure crond isn't running twice.
这篇关于为什么这个 cron 条目会执行两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文