Easy crontab mistake2015-08-23T10:29:37.152377-05:00 2015-08-23T10:29:37.152377-05:00 2015-08-23T10:29:37.122983-05:00
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:
MAILTOfirstname.lastname@example.org 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@example.com" 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.