Run shell script Oozie action

1k views Asked by At

I am trying to execute a shell script before my pig script using Oozie. As far as I can tell, I am doing all the same things as every example I can find. My action is:

<action name="shell_action" cred="yca_auth">
    <shell xmlns="uri:oozie:shell-action:0.1">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <exec>${appPath}/shell_script.sh</exec>
        <file>${appPath}/shell_script.sh#shell_script.sh</file>

        <ok to="pig_script_action"/> <error to="kill"/>
    </shell>
</action>

But I keep getting the error:

Caused by: org.apache.oozie.workflow.WorkflowException: E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'ok'. One of '{"uri:oozie:shell-action:0.1":file, "uri:oozie:shell-action:0.1":archive, "uri:oozie:shell-action:0.1":capture-output}' is expected.

I do not understand why this is happening. Please help

2

There are 2 answers

0
Kurt Maegerle On

The problem was that ok to and error to should not have been inside the

0
Kevin Zhang On

The right configuration is as following:

<action name="shell_action" cred="yca_auth">
    <shell xmlns="uri:oozie:shell-action:0.1">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <exec>${appPath}/shell_script.sh</exec>
        <file>${appPath}/shell_script.sh#shell_script.sh</file>
    </shell>
    <ok to="pig_script_action"/> 
    <error to="kill"/>
</action>