FrankWiles.com

Easy Crontab Mistake

So I recently noticed a client’s system wasn’t running the cron jobs we had setup in crontab. Everything looked normal. Originally it was written like this:

[email protected]
DJANGO_SETTINGS_MODULE="client.settings.dev"

0 * * * * /path/to/script.py

Did you spot the problem? No ok good, I feel a little better. As it turns out we were not seeing and understanding the following log entry to syslog:

ERROR (Missing newline before EOF, this crontab file will be ignored)

Does that help you spot it? The MAILTO= is missing quotes around its value! sigh It should read:

MAILTO="[email protected]"
DJANGO_SETTINGS_MODULE="client.settings.dev"

0 * * * * /path/to/script.py

It’s an easy thing to miss and kinda embarrassed it took me so long to spot it myself. Hopefully, this post will help others avoid it in the future.

Posted 07 May 2013