2016-03-29 15 views
0

私はoozieから実行したいシェルスクリプトを持っていますが、失敗しています。シェルスクリプトが正常に動作しているとき シェルスクリプト呼び出しがoozieから失敗しました

<workflow-app xmlns="uri:oozie:workflow:0.4" name="test1_wf"> 
     <credentials> 
       <credential name="hive2_cred" type="hive2"> 
         <property> 
           <name>hive2.jdbc.url</name> 
           <value>${hive2_jdbc_uri}</value> 
         </property> 
         <property> 
           <name>hive2.server.principal</name> 
           <value>${hive2_server_principal}</value> 
         </property> 
       </credential> 
     </credentials> 

     <start to="move_stg_files_to_archive"/> 

     <action name="move_stg_files_to_archive"> 
      <ssh xmlns="uri:oozie:ssh-action:0.1"> 
      <host>${user_host_name}</host> 
       <command>home/hduser/scripts/test1.sh</command>    
      </ssh> 
     <ok to="dly_load_wf_complete"/> 
      <error to="fail"/> 
     </action> 

<kill name="fail"> 
<message>Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message> 
</kill> 

<end name="dly_load_wf_complete"/> 
</workflow-app> 

- :

シェルスクリプト(test1.sh): -

#!/usr/bin/ksh 
. $PWD/test1.param 

kinit -k -t /home/$USER_ID/"$USER_ID".keytab $USER_ID 

for tablename in $tablelist 
do 
    for filename in `hadoop fs -ls $sqoop_dir/$tablename|awk '{print $8}'|rev|awk -F '/' '{print $1}'|rev` 
    do 
     hadoop fs -mv $sqoop_dir/$tablename/"$filename" $archive_dir/$tablename/"$filename"_`date +%Y%m%d%H%M%S` 
    done 
done 

exit 0 

パラメータファイル: -

export sqoop_dir=/user/hduser/staging 
export archive_dir=/user/hduser/archive 
export tablelist="table1 table2 table3 table4 table5" 
export USER_ID=superusr1 

Workflow.xml手動でスタンドアロンで実行します。

答えて

0

私のシェルスクリプトから最初の行#!/usr/bin/kshを削除したときにうまくいきました。しかし、なぜこの線で失敗したのかは分かりません。

関連する問題