crontab에서 python 스크립트를 실행하려고합니다.local() 회의 중 python 스크립트를 실행하지 못했습니다.
은 crontab가 호출import sys
import datetime
from fabric.api import local
ystd = datetime.date.today() - datetime.timedelta(days=1)
c = ystd.strftime('%Y-%m-%d')
print(c)
print('Start to format file ...')
......
print('Start to upload on HDFS ...')
local("/home/hadoop/hadoop/bin/hadoop fs -put " + finalfile + " /user/hadoop/yunying/openapp")
print('Start to upload on MaxCompute ...')
......
, 로그 파일이 같은입니다 :
2016-07-01
Start to format file ...
Start to upload on HDFS ...
[localhost] local: /home/hadoop/hadoop/bin/hadoop fs -put /data/uxin/nsq_client_active_collect/hadoop/openappfinal.log /user/hadoop/yunying/openapp
그리고이 과정이 끝난
5 0 * * * python /home/hadoop/import_openapp.py >> /home/hadoop/openapp.out 2>&1
파이썬 스크립트는 다음과 같은 것입니다. 찾을 수 없습니다. ps -ef|grep python
local()
회의 중에 끝나야하는 이유는 무엇입니까?
cron에서 실행되는 모든 것은 아주 최소한의 환경에서만 실행되므로, PYTHONPATH를 조정할 때 의존한다면 그럴 것입니다. – Vatine
쉘에서/home/hadoop/hadoop/bin/hadoop fs -put /data/uxin/nsq_client_active_collect/hadoop/openappfinal.log/user/hadoop/yunying/openapp 명령을 실행하려고 시도 했습니까? cron이 올바른 사용자의 crontab에 설정되어 있습니까? 모든 권한 문제가 있습니까? – BangTheBank