【发布时间】:2017-05-03 22:12:27
【问题描述】:
我正在使用oozie 发送带有附件的电子邮件。我正在做如下。
<workflow-app name="Email" xmlns="uri:oozie:workflow:0.5">
<start to="email-0fdf"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="email-0fdf">
<email xmlns="uri:oozie:email-action:0.2">
<to>xxxxxxxxxxxxxxx@xxxxx</to>
<subject>job success</subject>
<content_type>text/plain</content_type>
<attachment>/user/XXXX/logs/2017-05-03/exec.log</attachment>
</email>
<ok to="End"/>
<error to="Kill"/>
</action>
<end name="End"/>
</workflow-app>
现在在<attachment>/user/XXXX/logs/2017-05-03/exec.log</attachment> 附近的工作流程中,日期总是会发生变化。
我如何传递当调用工作流程时我想发送特定日期的附件的变量。
已编辑问题。
我的 shell 脚本:
#!/bin/bash
TIMESTAMP=`date "+%Y-%m-%d"`
path=/user/$USER/logging/${TIMESTAMP}/status/${TIMESTAMP}.fail_log
path1=/user/$USER/logging/`date -d "-1 days" '+%Y-%m-%d'`/status/`date -d "-1 days" '+%Y-%m-%d'`.fail_log
echo filePath=$path
echo filePath1=$path1
我的新工作流程:
<workflow-app name="My_Workflow" xmlns="uri:oozie:workflow:0.5">
<start to="shell-05e6"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="shell-05e6">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>shell.sh</exec>
<file>/user/xxxxx/oozie/email/lib/shell.sh#shell.sh</file>
<capture-output/>
</shell>
<ok to="email-66c2"/>
<error to="Kill"/>
</action>
<action name="email-66c2">
<email xmlns="uri:oozie:email-action:0.2">
<to>myemail@mycompany.com</to>
<subject>job status</subject>
<body>job status ${wf:actionData('shell-05e6')['filePath']}</body>
<content_type>text/plain</content_type>
<attachment>${wf:actionData('shell-05e6')['filePath']},${wf:actionData('shell-05e6')['filePath1']}</attachment>
</email>
<ok to="End"/>
<error to="Kill"/>
</action>
<end name="End"/>
现在,如果其中一个位置没有文件,请说 filepath 或 filepath1,则电子邮件操作失败。
我想要的是不管文件是否存在我希望电子邮件操作成功
【问题讨论】:
-
告诉我你最喜欢哪种方法。
标签: hadoop hdfs oozie oozie-coordinator