Oozie: How to pass current date to Work Flow

Coordinator.xml

<coordinator-app name=”oozie-coordinator” frequency=”1440″ start=”2017-10-06T15:00Z” end=”2099-09-19T13:00Z” timezone=”Canada/Eastern” xmlns=”uri:oozie:coordinator:0.1″>
<action>
<workflow>
<app-path>${workflowxml}</app-path>

<configuration>
<property>
<name>currentDate</name>
<value>${coord:formatTime(coord:dateOffset(coord:nominalTime(), 0,
‘DAY’), “yyyyMMdd”)}
</value>
</property>
</configuration>

</workflow>
</action>
</coordinator-app>

**Change “0” to -1 if you prefer PREVIOUS DATE

Access currentDate in your workflow.xml and pass it to your shell / ssh action

<ssh xmlns=”uri:oozie:ssh-action:0.1″>

<host>${focusNode}</host>

<command>${sh1_script}</command>

<args>${currentDate}</args>

<capture-output/>
</ssh>

 

Use it in your shell script

#!/bin/bash

touch $1

Advertisements

About shalishvj : My Experience with BigData

6+ years of experience using Bigdata technologies in Architect, Developer and Administrator roles for various clients. • Experience using Hortonworks, Cloudera, AWS distributions. • Cloudera Certified Developer for Hadoop. • Cloudera Certified Administrator for Hadoop. • Spark Certification from Big Data Spark Foundations. • SCJP, OCWCD. • Experience in setting up Hadoop clusters in PROD, DR, UAT , DEV environments.
This entry was posted in oozie, Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s