crontab
fails to execute a Python script. The command line I am using to run the Python script is ok.
These are solutions I had tried:
- add
#!/usr/bin/env python
at the top of themain.py
- add
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
at the top ofcrontab
chmod 777
to themain.py
fileservice cron restart
my crontab is:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
*/1 * * * * python /home/python_prj/main.py
and the log in /var/log/syslog is:
Nov 6 07:08:01 localhost CRON[28146]: (root) CMD (python /home/python_prj/main.py)
and nothing else.
The main.py
script calls some methods from other modules under python_prj
, does that matter?
Anyone can help me?
command >> /path/to/output.log 2>&1
otherwise check email that cron sends. – jfs Nov 6 '12 at 14:37