How to Run Shell script in Oozie using SSH action

Apache Hadoop is open source framework. There are so many jobs running in different time framework in hadoop ecosystem. there are some open source job scheduler hadoop job scheduler.
Oozie
Azkaban
Oozie is also open source a server based workflow scheduler engine. Oozie has all copiability like job scheduler tool.
Now I am going show here how to execute the shell script using SSH action in Oozie workflow.
If you want to perform SSH action in Oozie you need to required min three below files

Bash Script (.sh file)

sample_shell_script.sh

mkdir person
echo "Neeraj,Sen,USA" >> person/person.txt 
echo "Suraj,Nayak,INDIA" >> person/person.txt  
echo "Bhagwan,Soni,INDIA" >> person/person.txt
job.properties
#REQUIRED OOZIE WORKFLOW Parameter:
nameNode=hdfs://quickstart.cloudera:8020
jobTracker= quickstart.cloudera:8032
oozie.use.system.libpath=true
oozie.wf.rerun.failnodes=true
#HDFS Location 
oozie.wf.application.path=/user/ cloudera /oozie_stack/fullWorkFLow.xml
remoteNode=cloudera@ quickstart.cloudera
emailToAddress=sen.neeraj99@gmail.com

#OOZIE WORKFLOW  Parameter:
shellScript=bash /home/cloudera/oozie_stack/sample_shell_script.sh
fullWorkFlow.xml
<workflow-app name="sample_oozie_action" xmlns="uri:oozie:workflow:0.5">
<start to="sample_oozie_ssh_shell_action"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="sample_oozie_ssh_shell_action" cred="hive2">
<ssh xmlns="uri:oozie:ssh-action:0.1">
<host>${remoteNode}</host>
<command>${shellScript}</command>
<args>${wf:id()}</args>
<capture-output/>
</ssh>
<ok to="sendSuccessEmail"/>
<error to="sendFailureEmail"/>
</action>
<action name="sendSuccessEmail">
<email xmlns="uri:oozie:email-action:0.1">
<to>${emailToAddress}</to>
<subject>sample_oozie_ssh_shell_action  Successfully completed with workflowId : ${wf:id()}</subject>
<body>
Hi Team,
sample_oozie_ssh_shell_action sucessfully completed 
Workflow id  : ${wf:id()}

Thanks and Regards,
Neeraj K Sen.            
</body>
</email>
<ok to="End"/>
<error to="Kill"/>
</action>
<action name="sendFailureEmail">
<email xmlns="uri:oozie:email-action:0.1">
<to>${emailToAddress}</to>
<subject>sample_oozie_ssh_shell_action with workflowId : ${wf:id()}</subject>
<body>
Hi Team,
sample_oozie_ssh_shell_action failed 
Workflow id  : ${wf:id()}

Thanks and Regards,
Neeraj K Sen.
</body>
</email>
<ok to="Kill"/>
<error to="Kill"/>
</action>
<end name="End"/>
</workflow-app>  

Once completed the above files. Put the workflow.xml into HDFS location.
Hadoop fs -put fullWorkFLow.xml /user/ cloudera /oozie_stack/fullWorkFLow.xml
How to execute the workflow :-

 oozie job http://quickstart.cloudera:11000/oozie  -config job.properties -run 

execute oozie run

 oozie job http://quickstart.cloudera:11000/oozie  -info 0000005-161107164027356-oozie-oozie-W

execute oozie info

 Email Validation 

email