<?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 Running a Sqoop script in the background appears to 'hang' but works when running in the foreground in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96509#M9932</link>
    <description>&lt;P&gt;Consdering the following bash script for Sqoop:&lt;/P&gt;&lt;P&gt;#!/bin/sh &lt;/P&gt;&lt;P&gt;connection_string="jdbc:sqlserver://remoteserver.somehwere.location-asp.com:1433;database=idistrict" &lt;/P&gt;&lt;P&gt;user_name="OPSUser" &lt;/P&gt;&lt;P&gt;db_password="OPSReader" &lt;/P&gt;&lt;P&gt;sqoop_cmd="list-databases" &lt;/P&gt;&lt;P&gt;sqoop $sqoop_cmd --connect $connection_string --username $user_name --password $db_password&lt;/P&gt;&lt;P&gt;We can run this just fine in the foreground, i.e.:&lt;/P&gt;&lt;P&gt;./sqoop_test.sh&lt;/P&gt;&lt;P&gt;But running it in the background like so:&lt;/P&gt;&lt;P&gt;./sqoop_test.sh &amp;amp;&lt;/P&gt;&lt;P&gt;The script appears to 'hang' when kicking off the actual sqoop command...i.e. nothing happens at all.&lt;/P&gt;&lt;P&gt;Using -x on the #!/bin/sh line shows that we end up at the last line of the script and then nothing...&lt;/P&gt;&lt;P&gt;We have tried all kinds of iterations of different commands like:&lt;/P&gt;&lt;P&gt;nohup bash sqoop.sh &amp;gt; results.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/P&gt;&lt;P&gt;./sqoop.sh &amp;amp;&amp;gt; /dev/null &amp;amp;&lt;/P&gt;&lt;P&gt;switched to #!/bin/bash&lt;/P&gt;&lt;P&gt;Any ideas?  The odd thing is that the same exact script works fine both foregrounded and backgrounded on a different cluster.  /etc/profile, and .bash_profile don't look to have any major differences. &lt;/P&gt;</description>
    <pubDate>Wed, 04 Nov 2015 05:12:43 GMT</pubDate>
    <dc:creator>kbaxley</dc:creator>
    <dc:date>2015-11-04T05:12:43Z</dc:date>
    <item>
      <title>Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96509#M9932</link>
      <description>&lt;P&gt;Consdering the following bash script for Sqoop:&lt;/P&gt;&lt;P&gt;#!/bin/sh &lt;/P&gt;&lt;P&gt;connection_string="jdbc:sqlserver://remoteserver.somehwere.location-asp.com:1433;database=idistrict" &lt;/P&gt;&lt;P&gt;user_name="OPSUser" &lt;/P&gt;&lt;P&gt;db_password="OPSReader" &lt;/P&gt;&lt;P&gt;sqoop_cmd="list-databases" &lt;/P&gt;&lt;P&gt;sqoop $sqoop_cmd --connect $connection_string --username $user_name --password $db_password&lt;/P&gt;&lt;P&gt;We can run this just fine in the foreground, i.e.:&lt;/P&gt;&lt;P&gt;./sqoop_test.sh&lt;/P&gt;&lt;P&gt;But running it in the background like so:&lt;/P&gt;&lt;P&gt;./sqoop_test.sh &amp;amp;&lt;/P&gt;&lt;P&gt;The script appears to 'hang' when kicking off the actual sqoop command...i.e. nothing happens at all.&lt;/P&gt;&lt;P&gt;Using -x on the #!/bin/sh line shows that we end up at the last line of the script and then nothing...&lt;/P&gt;&lt;P&gt;We have tried all kinds of iterations of different commands like:&lt;/P&gt;&lt;P&gt;nohup bash sqoop.sh &amp;gt; results.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/P&gt;&lt;P&gt;./sqoop.sh &amp;amp;&amp;gt; /dev/null &amp;amp;&lt;/P&gt;&lt;P&gt;switched to #!/bin/bash&lt;/P&gt;&lt;P&gt;Any ideas?  The odd thing is that the same exact script works fine both foregrounded and backgrounded on a different cluster.  /etc/profile, and .bash_profile don't look to have any major differences. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 05:12:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96509#M9932</guid>
      <dc:creator>kbaxley</dc:creator>
      <dc:date>2015-11-04T05:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96510#M9933</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/225/kbaxley.html" nodeid="225"&gt;@Kent Baxley&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Is this cluster setup with queues?&lt;/P&gt;&lt;P&gt;Can you check if sqoop is waiting on other jobs to finish ?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 05:25:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96510#M9933</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-11-04T05:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96511#M9934</link>
      <description>&lt;P&gt;@Neeraj - No other jobs are waiting to finish and we can run this pretty much at-will in the foreground without things getting seemingly stuck. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 05:41:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96511#M9934</guid>
      <dc:creator>kbaxley</dc:creator>
      <dc:date>2015-11-04T05:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96512#M9935</link>
      <description>&lt;P&gt;add "`whoami'" and "`hostname`" to the script, see what prints out. I'd also add "2&amp;gt;&amp;amp;1 | tee -a log", i.e. redirect the output of the console to a file to see the output in foreground and background. It should give you some insight to what's happening. What specifically is the reason to running it in the background &lt;A rel="user" href="https://community.cloudera.com/users/225/kbaxley.html" nodeid="225"&gt;@Kent Baxley&lt;/A&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 05:54:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96512#M9935</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2015-11-04T05:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96513#M9936</link>
      <description>&lt;P&gt;check limits on the user in the background and in the foreground. There may be an OS limit on background processes.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 05:56:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96513#M9936</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2015-11-04T05:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96514#M9937</link>
      <description>&lt;P&gt;I would recommend using screen.  It gives you all of the benefits of a background job will all of the benefits of a job running in the foreground as well: &lt;A href="https://wiki.archlinux.org/index.php/GNU_Screen" target="_blank"&gt;https://wiki.archlinux.org/index.php/GNU_Screen&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 06:34:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96514#M9937</guid>
      <dc:creator>pcodding</dc:creator>
      <dc:date>2015-11-04T06:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96515#M9938</link>
      <description>&lt;P&gt;@Artem Ervits  The reason behind the backgrounding is there are quite a few tables with 2+ million records and they would like to run start a sqoop job in the background after hours (there has to be a better way to do this, in my opinion).&lt;/P&gt;&lt;P&gt;Foregrounded:&lt;/P&gt;&lt;P&gt;-bash-4.1$ ./sample_sqoop.sh &lt;/P&gt;&lt;P&gt;whoami sboddu &lt;/P&gt;&lt;P&gt;hostname node2.example.com &lt;/P&gt;&lt;P&gt;2015-11-05 19:15:03,027 INFO  - [main:] ~ Running Sqoop version: 1.4.6.2.3.0.0-2557 (Sqoop:92)
2015-11-05 19:15:03,043 WARN  - [main:] ~ Setting your password on the command-line is insecure. Consider using -P instead. (BaseSqoopTool:1021) &lt;/P&gt;&lt;P&gt;2015-11-05 19:15:03,248 INFO  - [main:] ~ Using default fetchSize of 1000 (SqlManager:98)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.3.0.0-2557/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.3.0.0-2557/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.3.0.0-2557/accumulo/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See &lt;A href="http://www.slf4j.org/codes.html#multiple_bindings" target="_blank"&gt;http://www.slf4j.org/codes.html#multiple_bindings&lt;/A&gt; for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] &lt;/P&gt;&lt;P&gt;master &lt;/P&gt;&lt;P&gt;tempdb &lt;/P&gt;&lt;P&gt;model
msdb &lt;/P&gt;&lt;P&gt;ReportServer &lt;/P&gt;&lt;P&gt;Idistrict_Distributer &lt;/P&gt;&lt;P&gt;idistrict&lt;/P&gt;&lt;P&gt;
iDistrict_Audit&lt;/P&gt;&lt;P&gt;
iDistrict_SlimDB &lt;/P&gt;&lt;P&gt;iDistrict_Reports &lt;/P&gt;&lt;P&gt;ReportServerTempDB &lt;/P&gt;&lt;P&gt;Idistrict_Replication &lt;/P&gt;&lt;P&gt;iDistrict_Attachment
FTL &lt;/P&gt;&lt;P&gt;Backgrounded:&lt;/P&gt;&lt;P&gt;-bash-4.1$ ./sample_sqoop.sh&amp;amp;
[2] 33320
-bash-4.1$ &lt;/P&gt;&lt;P&gt;whoami sboddu &lt;/P&gt;&lt;P&gt;hostname node2.example.com &lt;/P&gt;&lt;P&gt;[2]+  Stopped                 ./sample_sqoop.sh&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 08:58:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96515#M9938</guid>
      <dc:creator>kbaxley</dc:creator>
      <dc:date>2015-11-06T08:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96516#M9939</link>
      <description>&lt;P&gt;you're sqooping master, model, reportdb, not sure if you need to do that, I would limit the tables just to the ones you need. Other than that, please check ulimit on the user executing the job in foreground and background, &lt;A href="http://www.commandlinefu.com/commands/view/9893/find-ulimit-values-of-currently-running-process" target="_blank"&gt;http://www.commandlinefu.com/commands/view/9893/find-ulimit-values-of-currently-running-process&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 09:25:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96516#M9939</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2015-11-06T09:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96517#M9940</link>
      <description>&lt;P&gt;@Artem Ervits  Turns out that the factor was having the Accumulo Client installed on the machine alongside sqoop. &lt;/P&gt;&lt;P&gt;With Accumulo client in the mix, the sqoop script, if invoked to run in the background, would go into a Stopped state and could only resume if the script were foregrounded using the "fg" command. &lt;/P&gt;&lt;P&gt;Uninstalling the Accumulo client was what ultimately worked-around / fixed the issue.  &lt;/P&gt;&lt;P&gt;Not sure if this is a bug or due to the fact that sqoop is self is a bash script that calls another script that sources the configure-sqoop script. &lt;/P&gt;&lt;P&gt;Thanks for your help. &lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2015 06:12:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96517#M9940</guid>
      <dc:creator>kbaxley</dc:creator>
      <dc:date>2015-11-07T06:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96518#M9941</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/225/kbaxley.html" nodeid="225"&gt;@Kent Baxley&lt;/A&gt; did you have a chance to try using screen before uninstalling Accumulo client? Based on your discovery that redirecting output (sqoop.sh &amp;amp;&amp;gt; /dev/null &amp;amp;) was successful, I would think using screen would also work.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 00:19:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96518#M9941</guid>
      <dc:creator>amiller</dc:creator>
      <dc:date>2015-11-10T00:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96519#M9942</link>
      <description>&lt;P&gt;@Alex Miller   I was able to reproduce and personally had luck with screen as well as placing the "&amp;amp;" inside my test script itself at the end of the sqoop command rather than trying to background the script at invocation time (i.e. ./sqoop.sh &amp;amp;).  &lt;/P&gt;&lt;P&gt;The /dev/null thing was also successful for me as well with Accumulo in place. &lt;/P&gt;&lt;P&gt;The customer apparently had gone ahead and removed the Accumulo bits before they had a chance to test my suggestions since any further they weren't using it, anyway.  &lt;/P&gt;&lt;P&gt;So I really think there isn't a bug and we are hitting some bash-isms here more than anything else. &lt;/P&gt;&lt;P&gt;Thanks, all, for the tips. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 00:29:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96519#M9942</guid>
      <dc:creator>kbaxley</dc:creator>
      <dc:date>2015-11-10T00:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96520#M9943</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/225/kbaxley.html" nodeid="225"&gt;@Kent Baxley&lt;/A&gt; Thanks for sharing this. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 00:30:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96520#M9943</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-11-10T00:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96521#M9944</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/225/kbaxley.html"&gt;Kent Baxley&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Check what is the $PATH variable used in the script and in the CMD line. try adding the PATH to the script to be same as you run in the cmdline.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 21:11:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96521#M9944</guid>
      <dc:creator>Jagatheeshr</dc:creator>
      <dc:date>2016-01-04T21:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Sqoop script in the background appears to 'hang' but works when running in the foreground</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96522#M9945</link>
      <description>&lt;P&gt;
	I too had this problem. My bash script worked fine in my DEV environment as a background job and as a foreground job. However, in my TEST environment the job would only run as a foreground job. In TEST, running as a nohup job would seem to stop at the point where my Sqoop step was called. Ultimately I came across &lt;A href="https://unix.stackexchange.com/questions/125072/process-java-still-being-killed/125075"&gt;this thread&lt;/A&gt; which pointed me in the right direction. Essentially you can emulate nohup by "daemonizing" your script.&lt;/P&gt;
&lt;PRE&gt;setsid ./sqoop.sh &amp;lt;/dev/null &amp;amp;&amp;gt;myLog.out &amp;amp;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 10:37:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Running-a-Sqoop-script-in-the-background-appears-to-hang-but/m-p/96522#M9945</guid>
      <dc:creator>whitsonk</dc:creator>
      <dc:date>2017-11-01T10:37:01Z</dc:date>
    </item>
  </channel>
</rss>

