crontab 只执行第一行 [英] Crontab executes only first line
问题描述
我正在尝试在 centos/whm 下的 VPS 上设置几个 cron 作业.我在/var/spool/cron/root 中添加了以下几行:
I'm trying to setup several cron jobs on VPS under centos/whm. I've added to /var/spool/cron/root following lines:
*/5 * * * * find /some-dir/* ( ! -iname ".ht*" ) -delete
*/10 * * * * find /some-other-dir/* ( ! -iname ".ht*" ) -delete
但只执行了第一行(for/some-dir/).如果我交换行 -/some-other-dir/执行,/some-dir/- 不是.我尝试在每行的末尾添加分号,以放置空格、制表符、更改文件编码 - 什么都没有.
but only the first line executed ( for /some-dir/). If I swap lines - /some-other-dir/ executed, /some-dir/ - not. I've tried to put semicolons at the end of each line, to put spaces, tabs, change file encoding - nothing.
如何让 cron 处理这两个任务?
How can I make cron process both tasks?
这里是/var/log/cron 输出:
here is the /var/log/cron output:
Sep 18 11:05:01 host crond[3302]: (root) CMD (find /some-dir/* ( ! -iname ".ht*" ) -delete)
Sep 18 11:10:01 host crond[3303]: (root) RELOAD (/var/spool/cron/root)
谢谢!
推荐答案
似乎 cron 需要一个空行和 crontab 的结尾.我不小心留下了这样的台词和中提琴!两个任务都执行了.
It seems like cron requires an empty line an the end of crontab. I accidentally left such line and viola! both tasks executed.
这篇关于crontab 只执行第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!