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

Shell commands not working when i run from oozie

New Contributor

I am trying to run a shell script from oozie, when I use Hadoop commands in a shell script, oozie is working fine, but when I try to run shell commands inside script I am getting an error.

Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

<workflow-app xmlns="uri:oozie:workflow:0.5" name="wf_shell">
    <start to="shell1"/>
        <action name = "shell1">
        <shell xmlns="uri:oozie:shell-action:0.1">
        <ok to= "end" />
        <error to= "fail" />
        <kill name = "fail">
        <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    <end name="end"/>

echo "sample script execution" > /exam/user/example/path/test.txt #assume this is local path

this is not working but when I write Hadoop query in the shell script like below it is working.

hadoop fs -touchz /exam/user/example/path/test.txt

I need to run other oozie jobs from the shell script which I mentioned above. thanks in advance.


Re: Shell commands not working when i run from oozie

Expert Contributor

This will try to write to local filesystem on any node manager on which yarn will execute script.

echo "sample script execution">/exam/user/example/path/test.txt #assume this is local path

Please ensure /exam/user/example/path directory is present on all node manager logs.

To test you can try below script.

echo "sample script execution">/tmp/test.txt