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.
Frank Wiles
Founder of REVSYS and former President of the Django Software Foundation . Expert in building, scaling and maintaining complex web applications. Want to reach out? Contact me here or use the social links below.