oozie調用shell腳本

 

job.properties

nameNode=hdfs://cdh01:8020
resourceManager=cdh01:8032
queueName=default
examplesRoot=examples

oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/ssh
exec=log.sh
shellpath=${nameNode}/user/${user.name}/${examplesRoot}/apps/ssh

workflow.xml

<workflow-app xmlns="uri:oozie:workflow:1.0" name="shell-wf">
    <start to="shell-ssh"/>
    <action name="shell-ssh">
        <ssh xmlns="uri:oozie:ssh-action:0.1">       
            <host>root@cdh01</host>
            <command>echo</command>
            <args>"hello world!</args>
        </ssh>
        <ok to="shell-node"/>
        <error to="fail"/>
    </action>
    <action name="shell-node">
        <shell xmlns="uri:oozie:shell-action:1.0">
            <resource-manager>${resourceManager}</resource-manager>
            <name-node>${nameNode}</name-node>          
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <exec>${exec}</exec>
            <file>${shellpath}</file>
            <capture-output/>
        </shell>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

log.sh

#!/bin/bash

echo "-------開始執行---------"

$(date >> /home/example/oozie/ssh/date.log)

echo "-------執行結束----------"

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章