Constantine
Constantine

Reputation: 510

Crontab executes only first line

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!

Upvotes: 6

Views: 3825

Answers (1)

Constantine
Constantine

Reputation: 510

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

Upvotes: 7

Related Questions