Samuel M.
Samuel M.

Reputation: 91

Running python script from crontab

I've got a python file called color.py that if I run using python color.py will work on a file. I can run it okay from the terminal but it doesn't get called from crontab. I've used chmod +x color.py to try and make it executable.

The py file does start with

#!/usr/bin/env python

and the cron command is

*/1 * * * * /root/images/color.py

Upvotes: 1

Views: 12335

Answers (1)

anneb
anneb

Reputation: 5768

First check if following command works by running as user root (su or sudo):

/usr/bin/python /root/images/color.py

If that works, then edit crontab to:

*/1 * * * * /usr/bin/python /root/images/color.py

How do you check if the cron job succeeds or not?

Upvotes: 1

Related Questions