crontab报错

时间:2021-06-22 23:18:53

$mail

选择对应的数字查看邮件

File "/opt/app/python/tv-cms-for-ch/current/scripts/sync_cms_for_ch.py",
line 4, in ?
from ConnectionParams import *
File
"/opt/app/python/tv-cms-for-ch/releases/20140526054935/scripts/ConnectionParams.py",
line 3, in ?
from pymongo import MongoClient
ImportError: No module named pymongo
没有pymongo的原因是系统装了两个python,其中有一个版本没有装pymongo,执行
crontab的时候需要指定一下版本所在 的位置 15:23 [root@a02.cmsapi.ott.b28.tudou]$ whereis python
python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4
/usr/local/bin/python2.7-config /usr/local/bin/python2.7
/usr/local/bin/python /usr/local/lib/python2.7 /usr/local/lib/python2.4
/usr/include/python2.4 /usr/share/man/man1/python.1.gz
tty:[0] jobs:[0] cwd:[/opt/app/python]
15:23 [root@a02.cmsapi.ott.b28.tudou]$ python -c 'import sys;print sys.path'
['',
'/usr/local/lib/python2.7/site-packages/setuptools-3.5.1-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/pymongo-2.6_-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/site-packages/python_memcached-1.53-py2.7.egg', '/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages']
tty:[0] jobs:[0] cwd:[/opt/app/python]
15:24 [root@a02.cmsapi.ott.b28.tudou]$ crontab -e MAILTO=yang@a.com,wang@y.com #同步专题脚本
0 */1 * * * /usr/local/bin/python
/opt/app/python/tv-cms-for-ch/current/scripts/sync_cms_for_ch.py 2067 2014-06-04 15:14:41:crontab -e
2068 2014-06-04 15:15:17:whereis python
2070 2014-06-04 15:15:37:python -c 'import sys;print sys.path'
2071 2014-06-04 15:16:03:history