Why is cron not running my script?

Summary: Cron doesn’t run files with dots or underscores in them; remove that .sh!

Did you put your file in /etc/cron.daily or /etc/cron.weekly and it doesn’t run? Does cron just skip right over your file? Check that you don’t have a period or underscore in your filename. I’m talking about the .sh or .py you always put on your scripts. Yup, take that away.

All good now? I thought so.

It seems like I learn this lesson again every couple of years. This time I’m writing it down.

Update: A little additional research says that it isn’t cron; it’s run-parts that’s causing the problem. See the comments for details.

[ 2 comments | 0 pingbacks | , , , ]
Add post to: Delicious Reddit Slashdot Digg Technorati Google
(already: 0) Comment post

Comments

Dave , 29.07.2009 11:41 (after 167 days)

Wait, I run scripts from cron.daily with dots in them all the time. In fact, several packages on my system ship scripts in that directory with dots in their name, like slocate.cron for example.

Richard , 21.08.2009 10:31 (after 190 days)

Wow, someone found my blog!

Thanks for the comment, Dave. The link to your blog should provide you with a healthy piece of my awesome Google ranking. Yeah, you’re right; it wouldn’t make a difference.

A little additional research says that it isn’t cron; it’s run-parts. From the man page: “If neither the —lsbsysinit option nor the —regex option is given then the names must consist entirely of upper and lower case letters, digits, underscores, and hyphens.”

Thanks for helping me to clarify the behavior.

Comment post

Email: Password:
OpenID URL:
Forgot Login? Close