私はoozie
を使用して添付ファイル付きの電子メールを送信しています。私は以下のようにしています。添付ファイルの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>[email protected]</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>
のワークフローでは、日付が常に変更されます。
ワークフローが呼び出されたときに、その特定の日の添付ファイルを送信する変数を渡すにはどうすればよいですか。
編集した質問。
私のシェルスクリプト:
#!/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>[email protected]</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
どちらかと言うその後、電子メールアクションが失敗しています。
は、私が欲しいのは、私は電子メールのアクションが
あなたが最も好きなアプローチを教えてください。 –