Crontab executes only first line

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

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 

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.

How can I make cron process both tasks?

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) 

thanks!

回答1:

It seems like cron requires an empty line an the end of crontab. I accidentally left such line and viola! both tasks executed.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!