2017-07-26 101 views
1

我有一个oozie shell动作,它从HDFS txt文件获取输入,但每次我调用txt文件时,它说目录不存在,但它存在于服务器上。Oozie Shell动作

这里是我的shell脚本:

#!/bin/bash 

Ingesta="MUM_APPs" 
msj="'${1}'" 
#alerta=`hdfs dfs -test -e /user/inpt_red/oozie/workspace/envio_sms/EnviaSMS/Num_Alerta.txt` 

while read line 
do 
line=${i} 
    Num=$(echo $line | cut -d '|' -f1) 
    Proceso=$(echo $line | cut -d '|' -f5) 

    if [ "$Proceso" == "*" ] || [ "$Proceso" == "$Ingesta" ]; then 
     source /user/inpt_red/oozie/workspace/envio_sms/EnviaSMS/EnviaSMS.sh ${Num} "'ALERTA!! $Ingesta (`date +%d-%m-%Y` `date +%H:%M:%S`), $msj'" 
    fi`enter code here` 

done < <(hadoop fs -cat hdfs://mixsfwdebda01.telefonica.com/user/inpt_red/oozie/workspace/envio_sms/EnviaSMS/Num_Alerta.txt) 

编辑1:

这里是新的错误我得到:

sh: line 17: syntax error near unexpected token `<' 
sh: line 17: `done < <(hadoop fs -cat hdfs://mixsfwdebda01.telefonica.com/user/inpt_red/oozie/workspace/envio_sms/EnviaSMS/Num_Alerta.txt)' 
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1] 
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.impl.MetricsSystemImpl). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 

回答

2

或者,你可以改变你脚本到:

hadoop fs -cat hdfs://mixsfwdebda01.telefonica.com/user/inpt_red/oozie/workspace/envio_sms/EnviaSMS/Num_Alerta.txt |\ 
while read line; do 
    echo "${line}" 
    #Some Stuff 
    #some more stuff 
done 
+0

是的,你是对的。我混淆了事情抱歉。 –

+0

是的..谢谢你的工作.. Ty男人。 –