Root Cron to run Python

I was having some issues with a cron job I created as root using crontab -e
the entry was: */15 * * * * /path/to/
After ripping my hair out overnight (Troubleshooting tips):

tail /var/log/cron (checks if it is running)
add a line to your crontab: MAILTO=”” – will email you debugging info

Here’s the solution:

Wrap the calling of python in shell and set up the environment first.

Modify the crontab entry to:
*/15 * * * * /bin/csh /path/to/

setenv PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin:${PATH}
/usr/local/bin/python2.7 /usr/local/bin/

Leave a Reply

Your email address will not be published. Required fields are marked *