Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Shell commands not working when i run from oozie

avatar
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">
                <job-tracker>${jobTracker}</job-tracker>
                <name-node>${nameNode}</name-node>
                <configuration>
                <property>
                <name>mapred.job.queue.name</name>
                <value>default</value>
                </property>
                </configuration>
                <exec>sample.sh</exec>
                <file>/user/example/path/sample.sh</file>
<capture-output/>
</shell>
        <ok to= "end" />
        <error to= "fail" />
</action>
        <kill name = "fail">
        <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
                </kill>
    <end name="end"/>
</workflow-app>

sample.sh

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.

1 REPLY 1

avatar
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