问题
I am currently using Oozie to call Shell script. On base of exit value of the called shell script, Oozie can easily choose OK or ERROR node, but what if Shell exits with other values than 0 or 1? can Oozie use the decision node to switch to different nodes on base of the exit value of the called Shell script?
I am thinking about using EL function, but do not know whyc EL function get the exit code of previously called Shell script
回答1:
- make sure that the shell exits with non-zero for critical errors (irrecoverable, go to kill) and zero for success or app errors (continue workflow to check status)
- make sure that the shell sends nothing to StdOut except your "soft" status code, otherwise you might blast the HashMap at step 4
- return your "soft" status report using Java properties syntax e.g.
echo "status.rc=0" ; echo "status.message=so far, so good"
- set
<capture_output/>
option in the Shell Action so that Oozie retrieves your status report in a HashMap (key/value) - branch the Workflow to a Decision node, check the value that shows the soft status (using
wf:actionData()
EL function), and branch accordingly
来源:https://stackoverflow.com/questions/32478911/calling-shell-script-in-oozie-how-to-use-decision-node-on-base-of-different-ret