Crontab executes only first line

拈花ヽ惹草 提交于 2019-12-12 09:42:01

问题


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.



来源:https://stackoverflow.com/questions/12479973/crontab-executes-only-first-line

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