Support Questions
Find answers, ask questions, and share your expertise

Passing oozie global configurations to shell script?

Passing oozie global configurations to shell script?

New Contributor

Hi Friends,

I have an oozie workflow that is executing shell script using the shell action, as I have a lot of shell actions means I need to pass parameters like database,user,password for every single shell action, is there any way that I can define global variables and send them to my shell script? I was using environment variables but I have to replicate that process for every shell action...

This is what I have:

  1. oozie.use.system.libpath=true
  2. security_enabled=False
  3. dryrun=False
  4. nameNode=hdfs://localhost:8020
  5. user_name=test
  6. jobTracker=localhost::8032
  7. <workflow-app name="My_Workflow" xmlns="uri:oozie:workflow:0.5">
  8. <start to="shell-a0a5"/>
  9. <kill name="Kill">
  10. <message>Error[${wf:errorMessage(wf:lastErrorNode())}]</message>
  11. </kill>
  12. <action name="shell-a0a5">
  13. <shell xmlns="uri:oozie:shell-action:0.1">
  14. <job-tracker>${jobTracker}</job-tracker>
  15. <name-node>${nameNode}</name-node>
  16. <exec>script1.sh</exec>
  17. <file>/user/hive/script1.sh#script1.sh</file>
  18. </shell>
  19. <ok to="End"/>
  20. <error to="Kill"/>
  21. </action>
  22. <end name="End"/>

any ideas or comments would be really appreciated.

Thanks

1 REPLY 1

Re: Passing oozie global configurations to shell script?

New Contributor

Hello Jeffry,

Ozzie have the options of passing parameters and configurations as global parameters(Workflow level) instead of passing the parameters for every action.

This way will helps in minimising the no.of lines in workflow XML also.

Please refer to the XSD https://github.com/apache/oozie/blob/master/client/src/main/resources/oozie-workflow-0.5.xsd