<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to get logs of shell scripts in oozie in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53643#M59198</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/18127"&gt;@mbigelow&lt;/a&gt;&amp;nbsp;I have tried like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;mkdir -p /tmp/$USER/logs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;touch /tmp/$USER/logs/${TIMESTAMP}.success_log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But in the /tmp folder I don't see any folder called logs and cannot find the file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but when I go to /tmp folder on the edgenode I can create files and directories.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please advise where the problem is occuring&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 19:16:54 GMT</pubDate>
    <dc:creator>sanjeev20</dc:creator>
    <dc:date>2017-04-13T19:16:54Z</dc:date>
    <item>
      <title>How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53383#M59192</link>
      <description>&lt;P&gt;I have a shell script in HDFS. I want to schedule this script in oozie.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;#!/bin/bash&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LOG_LOCATION=/home/$USER/logs&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;exec 2&amp;gt;&amp;amp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[ $# -ne 1 ] &amp;amp;&amp;amp; { echo "Usage : $0 table ";exit 1; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;table=$1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;TIMESTAMP=`date "+%Y-%m-%d"`&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;touch /home/$USER/logs/${TIMESTAMP}.success_log&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;touch /home/$USER/logs/${TIMESTAMP}.fail_log&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;success_logs=/home/$USER/logs/${TIMESTAMP}.success_log&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;failed_logs=/home/$USER/logs/${TIMESTAMP}.fail_log&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;#Function to get the status of the job creation&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;function log_status&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status=$1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;message=$2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if [ "$status" -ne 0 ]; then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;echo "`date +\"%Y-%m-%d %H:%M:%S\"` [ERROR] $message [Status] $status : failed" | tee -a &amp;nbsp; &amp;nbsp; &amp;nbsp;"${failed_logs}"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;#echo "Please find the attached log file for more details"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; exit 1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; echo "`date +\"%Y-%m-%d %H:%M:%S\"` [INFO] $message [Status] $status : success" | tee -a &amp;nbsp; &amp;nbsp;"${success_logs}"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; fi&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; `hive -e "create table testing.${table} as select * from database.${table}"`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; g_STATUS=$?&lt;BR /&gt;&amp;nbsp; &amp;nbsp; log_status $g_STATUS "Hive create ${table}"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; *******************************************************************************************************************************&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a some questions regarding using oozie to schedule shell scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) In my script I have failed and success logs which give me the result of the script whether it is successful or failed. Can we have this kind of feature in HDFS also while using oozie?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) IN the script I am also collecting the stdout logs as you can see in the 2nd and 3rd lines after the shebang in my script. Can this also be achieved in HDFS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so how can we achieve these both in `HDFS` while scheduling shell scripts using oozie.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone explain please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there are bettere ways to do things in oozie please let me know&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 11:25:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53383#M59192</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2022-09-16T11:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53440#M59193</link>
      <description>Your best bet is to write out to a temporary location on the local FS and then upload them to HDFS at the end. It is wonky but the best way to do this with a bash script scheduled through Oozie. Be careful to keep this in check as it will likely generate a lot of small files.</description>
      <pubDate>Mon, 10 Apr 2017 21:42:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53440#M59193</guid>
      <dc:creator>mbigelow</dc:creator>
      <dc:date>2017-04-10T21:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53610#M59194</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/18127"&gt;@mbigelow&lt;/a&gt;&amp;nbsp;As you can see in my script I am using touch command to create files in Linux but when I schedule the script in oozie, It throws out error touch cannot create file or directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why this is happening&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 03:52:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53610#M59194</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-13T03:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53612#M59195</link>
      <description>I can't say for certain but it is probably because it is running the script on whatever node the container ends up running on. So if /home/mbigelow/logs/20170412... doesn't exist on each and every node then it will fail. I tend to stick with /tmp as it is always there and writable for all users.</description>
      <pubDate>Thu, 13 Apr 2017 04:07:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53612#M59195</guid>
      <dc:creator>mbigelow</dc:creator>
      <dc:date>2017-04-13T04:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53613#M59196</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/18127"&gt;@mbigelow&lt;/a&gt;&amp;nbsp;so If i save the logs to /tmp/sanje so I will be able collect them irrespective of the node it runs. Is this correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What about these:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LOG_LOCATION=/home/$USER/logs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;exec 2&amp;gt;&amp;amp;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These also should be on the /tmp folder is this correct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then move them to HDFS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 04:28:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53613#M59196</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-13T04:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53641#M59197</link>
      <description>that is correct. save all logs to /tmp and then upload to HDFS</description>
      <pubDate>Thu, 13 Apr 2017 18:22:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53641#M59197</guid>
      <dc:creator>mbigelow</dc:creator>
      <dc:date>2017-04-13T18:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53643#M59198</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/18127"&gt;@mbigelow&lt;/a&gt;&amp;nbsp;I have tried like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;mkdir -p /tmp/$USER/logs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;touch /tmp/$USER/logs/${TIMESTAMP}.success_log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But in the /tmp folder I don't see any folder called logs and cannot find the file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but when I go to /tmp folder on the edgenode I can create files and directories.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please advise where the problem is occuring&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 19:16:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53643#M59198</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-13T19:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53654#M59199</link>
      <description>&lt;P&gt;Did you check directly onto the specific data-node that ran the action ?&lt;/P&gt;&lt;P&gt;Only that node will have your log "localy"&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 09:46:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53654#M59199</guid>
      <dc:creator>mathieu.d</dc:creator>
      <dc:date>2017-04-14T09:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53655#M59200</link>
      <description>How can i do that?&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Apr 2017 10:04:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53655#M59200</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-14T10:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53657#M59201</link>
      <description>&lt;P&gt;How can you do what ?&lt;/P&gt;&lt;P&gt;Which specific part is blocking you ?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 10:19:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53657#M59201</guid>
      <dc:creator>mathieu.d</dc:creator>
      <dc:date>2017-04-14T10:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53658#M59202</link>
      <description>I mean how can we check the folders on datanodes. I don't know how to do it&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Apr 2017 11:36:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53658#M59202</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-14T11:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53659#M59203</link>
      <description>&lt;P&gt;Well, one way to do it would be to connect yourself in SSH to the datanodes.&lt;/P&gt;&lt;P&gt;For exemple, using putty or winscp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 11:43:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53659#M59203</guid>
      <dc:creator>mathieu.d</dc:creator>
      <dc:date>2017-04-14T11:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53672#M59204</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/11415"&gt;@mathieu.d&lt;/a&gt;&amp;nbsp;Here I am creating files in /tmp folder on datanodes right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I do hdfs dfs -put /tmp/$USER/...success.log /user/$USER/logs/...success.log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will this work ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 14:36:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53672#M59204</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-14T14:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53695#M59205</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/11415"&gt;@mathieu.d&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/18127"&gt;@mbigelow&lt;/a&gt;&amp;nbsp;Thank you both of you I was able to achieve the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First stored the logs in local and then uploaded them to HDFS&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 18:14:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/53695#M59205</guid>
      <dc:creator>sanjeev20</dc:creator>
      <dc:date>2017-04-14T18:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logs of shell scripts in oozie</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/69892#M59206</link>
      <description>&lt;P&gt;how did you stored logs in local? can you please provide me the way you did it.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 21:08:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-get-logs-of-shell-scripts-in-oozie/m-p/69892#M59206</guid>
      <dc:creator>shandy</dc:creator>
      <dc:date>2018-07-11T21:08:10Z</dc:date>
    </item>
  </channel>
</rss>

