我有下面的命令产生这个输出
命令:
oozie job -info 0007218-170910003406158-oozie-oozi-W | grep job | awk '{print $3}' | cut -c1-23 | sed 's/job/application/'
输出:
application_1505017974932_23474
application_1505017974932_23478
application_1505017974932_23477
application_1505017974932_23473
application_1505017974932_23475
application_1505017974932_23471
application_1505017974932_23469
application_1505017974932_23476
application_1505017974932_23472
application_1505017974932_23470
application_1505017974932_23495
application_1505017974932_23497
application_1505017974932_23500
application_1505017974932_23501
我需要将这些输出行作为输入传递给下面的命令,同时将日志文件存储在/tmp文件夹中 yarn logs -applicationId <applicationID> -Owner <userID> > /tmp/<applicationID>.txt
尝试使用for循环的一种语法来自动化这一点,但面临挑战。出现问题的for循环的电流如下所示
for appid in `oozie job -info 0007218-170910003406158-oozie-oozi-W | grep job | awk '{print $3}' | cut -c4-23 | sed 's/job/application/'`; do yarn logs -applicationId "${appid}" -Owner user9 > /tmp/ "${appid}"; done
目前我得到如下错误
Invalid ApplicationId specified
Invalid ApplicationId specified
Invalid ApplicationId specified
Invalid ApplicationId specified
Invalid ApplicationId specified
如果不将正确的applicationid指定为参数,通常会得到这个结果。
暂无答案!
目前还没有任何答案,快来回答吧!