shell 来自 oozie 的脚本调用失败

shell script call failing from oozie

我有一个 shell 脚本,我想从 oozie 执行它但是它失败了。

Shell 脚本 (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 }'|rev|awk -F '/' '{print }'|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:-

<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>

shell 脚本在手动独立执行时 运行 成功。

当我从 shell 脚本中删除第一行 #!/usr/bin/ksh 时,它对我有用。但是我不确定为什么这条线失败了。