开发者

python script does not run from cron

I have a 开发者_如何转开发python script "start.py" that executes well from the command line. There is only one statement in it (print "hello"). EDIT: start.py contains also a working interpreter directive in the first line.

As soon as I run the script from a cron job, every time it fires there is a message in syslog:

Jun  7 02:57:01 mit CRON[23275]: Module is unknown

I tried already to add PATH and PYTHONPATH information to the cron file:

$ cat /etc/cron.d/my_cron
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PYTHONPATH=/usr/lib/python2.6:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload:/usr/lib/python2.6/dist-packages:/usr/lib/pymodules/python2.6:/usr/lib/pymodules/python2.6/gtk-2.0:/usr/local/lib/python2.6/dist-packages
* * * * * mit /home/mit/dev/start.py

I found several answers and solutions that seem the same but nothing helped me. What am I missing?


A recent update of PAM broke cron. Try restarting your computer (or restarting cron with sudo /etc/init.d/cron restart)


You forgot to add python in front of it.

* * * * * mit /usr/bin/python /home/mit/dev/start.py
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜