Crontab仅执行第一行 [英] Crontab executes only first line

查看:345
本文介绍了Crontab仅执行第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以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

,但仅执行第一行(对于/ 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屋!

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