前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >oozie调用shell脚本

oozie调用shell脚本

作者头像
静谧星空TEL
发布2021-04-27 11:52:18
1.4K0
发布2021-04-27 11:52:18
举报

job.properties

代码语言:javascript
复制
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

代码语言:javascript
复制
  <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

代码语言:javascript
复制
#!/bin/bash

echo "-------开始执行---------"

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

echo "-------执行结束----------"
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-04-14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档