<?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>topic Re: Problems with nohup in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552461#M917554</link>
    <description>Try redirecting stdin from /dev/null.  If there are commands playing with the terminal (such as stty), that might help.&lt;BR /&gt;</description>
    <pubDate>Fri, 13 Jul 2001 15:01:38 GMT</pubDate>
    <dc:creator>Laurent Paumier</dc:creator>
    <dc:date>2001-07-13T15:01:38Z</dc:date>
    <item>
      <title>Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552455#M917548</link>
      <description>When attempting to nohup a script, the script apepars to start, but hangs.  After entering the command, nohup reports back with the PID, but doesn't return to a command line.  If I touch &lt;RETURN&gt;, I receive a second messsage that the script has stopped.&lt;BR /&gt;&lt;BR /&gt;# nohup /root/bin/ett_load.ksh &amp;amp;&lt;BR /&gt;[1]     2496&lt;BR /&gt;# Sending output to nohup.out&lt;BR /&gt;&lt;BR /&gt;(hangs so I touch &lt;ENTER&gt;)&lt;BR /&gt;&lt;BR /&gt;[1] + Stopped (tty output)     nohup /root/bin/ett_load.ksh &amp;amp;&lt;BR /&gt;&lt;BR /&gt;The man pages state that nohup will fail if the user does not have sufficient permission to write to the current directory or to their home directory.  However, this is not the case, especially since the script requires to run as root.&lt;BR /&gt;&lt;BR /&gt;I am certain that the problem is not with the script itself as I have tried it without nohup and it functions as advertised.&lt;BR /&gt;&lt;BR /&gt;The only item that I think might be affecting it is that the script su's to several users to perform different functions.&lt;/ENTER&gt;&lt;/RETURN&gt;</description>
      <pubDate>Fri, 13 Jul 2001 14:06:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552455#M917548</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T14:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552456#M917549</link>
      <description>Hi Brian:&lt;BR /&gt;&lt;BR /&gt;The 'su' within your script may be causing the problem.  If the script is running as root, then no password is necessary to do the 'su'.  If you are not running as root, and issue an 'su' then the process is attempting to read from stdin.  Since redirection to 'su' isn't allowed, the script will hang.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 13 Jul 2001 14:15:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552456#M917549</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-13T14:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552457#M917550</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;When the script is being executed I am logged in as root and the script is being run as root.  The su's in question are to oracle and another user.&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Fri, 13 Jul 2001 14:26:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552457#M917550</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T14:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552458#M917551</link>
      <description>What happens if you redirect stdout and stderr, even though nohup should handle it:&lt;BR /&gt;&lt;BR /&gt;nohup {script} &amp;gt;/tmp/stdout 2&amp;gt;/tmp/stderr &amp;amp;&lt;BR /&gt;&lt;BR /&gt;Robin.</description>
      <pubDate>Fri, 13 Jul 2001 14:46:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552458#M917551</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-07-13T14:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552459#M917552</link>
      <description>Hi Brian,&lt;BR /&gt;&lt;BR /&gt;One other thing that could cause this is if somewhere in your script (and especially if your are executing .profile's) there may be a stty tostop which will block when background jobs try to produce output.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Fri, 13 Jul 2001 14:51:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552459#M917552</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-13T14:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552460#M917553</link>
      <description>I tried that one, too, thinking that there might be some sort of contengency with permissions or another nohup, so I did:&lt;BR /&gt;&lt;BR /&gt;# nohup /root/bin/ett_load.ksh 1&amp;gt;/tmp/output 2&amp;gt;/tmp/errors &amp;amp;&lt;BR /&gt;&lt;BR /&gt;I did this hoping at least I might get something that would ive me some clue as to what was wrong.  No dice.&lt;BR /&gt;&lt;BR /&gt;By the way, system logs don't report anything unusual either.</description>
      <pubDate>Fri, 13 Jul 2001 14:54:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552460#M917553</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T14:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552461#M917554</link>
      <description>Try redirecting stdin from /dev/null.  If there are commands playing with the terminal (such as stty), that might help.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Jul 2001 15:01:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552461#M917554</guid>
      <dc:creator>Laurent Paumier</dc:creator>
      <dc:date>2001-07-13T15:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552462#M917555</link>
      <description>If I understood you correctly, I did the following:&lt;BR /&gt;&lt;BR /&gt;# nohup /root/bin/ett_load.ksh &amp;lt; /dev/null &amp;amp;&lt;BR /&gt;&lt;BR /&gt;But, unfortunately got the same error...</description>
      <pubDate>Fri, 13 Jul 2001 15:11:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552462#M917555</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T15:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552463#M917556</link>
      <description>Clay,&lt;BR /&gt;&lt;BR /&gt;I checked stty setting in the .profile for the 2 users referenced in the script.  What I came up with was:&lt;BR /&gt;&lt;BR /&gt;stty erase "^H" kill "^U" intr "^C" eof "^D"&lt;BR /&gt;stty hupcl ixon ixoff&lt;BR /&gt;&lt;BR /&gt;I'm not sure exactly what the second line does, but I'm pretty sure that the firstline simply gives the user the frequently used keyboard functions (i.e., backspace key, esc key).  I did try commenting them out and re-running the script.  No dice.&lt;BR /&gt;&lt;BR /&gt;Nohup 10&lt;BR /&gt;SysAdm 0</description>
      <pubDate>Fri, 13 Jul 2001 15:19:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552463#M917556</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T15:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552464#M917557</link>
      <description>Hi Brian:&lt;BR /&gt;&lt;BR /&gt;This is interesting.  Here's a simple script that executes fine in the foreground but hangs for SIGTTOU (background process attempting write):&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;su - anyuser -c "echo `date`"&lt;BR /&gt;#.end.&lt;BR /&gt;&lt;BR /&gt;Call the script "my.sh" and:&lt;BR /&gt;&lt;BR /&gt;./my.sh #...works as expected...&lt;BR /&gt;./my.sh &amp;gt; /dev/null 2&amp;gt;&amp;amp;1  #...works...&lt;BR /&gt;./my.sh &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp; #...hangs...&lt;BR /&gt;&lt;BR /&gt;Therefore...?&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 13 Jul 2001 15:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552464#M917557</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-13T15:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552465#M917558</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;So what you're tring to impress upon me is the fact that: &lt;BR /&gt;&lt;BR /&gt;1) The problem is not with nohup, but with the process running in the background.&lt;BR /&gt;2) The background process is attempting to write to the terminal, but can't and therefore hangs.&lt;BR /&gt;&lt;BR /&gt;So, somewhere I need to redirect how it is writing or where it is writing to...</description>
      <pubDate>Fri, 13 Jul 2001 15:26:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552465#M917558</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T15:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552466#M917559</link>
      <description>Does anything get created in the output file?  Try putting: set -x as the first line of the script.  This will echo to the output file each line in the main script as it executes.  That way at least you might be able to find out which line it is failing on.</description>
      <pubDate>Fri, 13 Jul 2001 15:29:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552466#M917559</guid>
      <dc:creator>Tracey</dc:creator>
      <dc:date>2001-07-13T15:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552467#M917560</link>
      <description>Tracy,&lt;BR /&gt;&lt;BR /&gt;I tried the set -x and got the same output in the nohup.out file.  Nothing.  &lt;BR /&gt;&lt;BR /&gt;I don't think that the script is the problem.  It really would appear to be something more like the ability of nohup (or &amp;amp;) to write output...</description>
      <pubDate>Fri, 13 Jul 2001 15:35:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552467#M917560</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T15:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552468#M917561</link>
      <description>Hi Brian:&lt;BR /&gt;&lt;BR /&gt;OK.  You must be doing 'su - user'.  Do a simple 'su user' and then all should be OK.  Clay had it nailed.  The script I posted was an effort to dissect things down to a simple test case.  The SIGTTOU is the tell-all.&lt;BR /&gt;&lt;BR /&gt;The 'su - user' causes "user"'s profile to be read and output.  Usually this is done to get environmental variables.  Instead, put the variables you need in your script and do a simple "su".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 13 Jul 2001 15:46:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552468#M917561</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-13T15:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552469#M917562</link>
      <description>Hi Brian,&lt;BR /&gt;&lt;BR /&gt;James' test made it possible to nail this.&lt;BR /&gt;What is going on is then the stty's and the tset's in the standard .profile are blocking when in background.&lt;BR /&gt;&lt;BR /&gt;I was able to add this block of code around the stty's ands tset's and that fixed the problem.&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 -a -t 1 -a -t 2 ]&lt;BR /&gt;  then&lt;BR /&gt;    do tset and stty commands&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;This tests if stdin,stdout, and stderr is a terminal. If so, do the stty/tset stuff otherwise bypass the stty/tset stuff.&lt;BR /&gt;&lt;BR /&gt;If you will modify the .profiles of each user you su - to, I think you will be fixed.&lt;BR /&gt;&lt;BR /&gt;Regards and an interesting problem, Clay</description>
      <pubDate>Fri, 13 Jul 2001 15:50:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552469#M917562</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-13T15:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552470#M917563</link>
      <description>Hi again Brian,&lt;BR /&gt;&lt;BR /&gt;If you have any tabs commands in your .profile then the same rules apply.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Fri, 13 Jul 2001 15:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552470#M917563</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-13T15:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552471#M917564</link>
      <description>HI&lt;BR /&gt;Can you try redirecting output in script to log file before you start your actual commands.&lt;BR /&gt;&lt;BR /&gt;exec &amp;gt;LOGFILE 2&amp;gt;&amp;amp;1&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;Prashant Deshpande.</description>
      <pubDate>Fri, 13 Jul 2001 15:55:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552471#M917564</guid>
      <dc:creator>Deshpande Prashant</dc:creator>
      <dc:date>2001-07-13T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552472#M917565</link>
      <description>If it's just the commands in user's .profile that hang, you could run the command in the foreground and, after a few seconds, ^Z and bg...  Not a clean solution, but maybe a workaround the problem.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Jul 2001 16:00:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552472#M917565</guid>
      <dc:creator>Laurent Paumier</dc:creator>
      <dc:date>2001-07-13T16:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552473#M917566</link>
      <description>Man, this is a lot tougher than I originally thought.  Alas, no joy.  Clay, Laurent, and Prashant, I still cannot get it to work correctly.  I have attempted all three of your suggestions, but still get the same results.  Here is an excerpt from one of the .profiles, after the mod Clay suggested, that are referenced by the script:&lt;BR /&gt;&lt;BR /&gt;INTER=$(set -o |grep interactive | awk '{print $2}')&lt;BR /&gt;if [ "$INTER" = "on" ]&lt;BR /&gt; then&lt;BR /&gt;# Set up the terminal:&lt;BR /&gt;if [ "$TERM" = "" ]&lt;BR /&gt; then&lt;BR /&gt;  eval ` tset -s -Q -m ':?hp' `&lt;BR /&gt; else&lt;BR /&gt;  eval ` tset -s -Q `&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 -a -t 1 -a -t 2 ]&lt;BR /&gt; then&lt;BR /&gt;  stty erase "^H" kill "^U" intr "^C" eof "^D"&lt;BR /&gt;  stty hupcl ixon ixoff&lt;BR /&gt;  tabs&lt;BR /&gt;fi&lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;Hope I did it correctly.</description>
      <pubDate>Fri, 13 Jul 2001 17:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552473#M917566</guid>
      <dc:creator>Brian Atkins</dc:creator>
      <dc:date>2001-07-13T17:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with nohup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552474#M917567</link>
      <description>Hi Brian,&lt;BR /&gt;&lt;BR /&gt;Put the if [ -t 0 ... ]&lt;BR /&gt;around the tset code as well. It too will block.&lt;BR /&gt;&lt;BR /&gt;Also, do a ps while you are blocked and you should see the process in question.&lt;BR /&gt;&lt;BR /&gt;I would first try James's little script as an su - username -c command to see if you get the .profiles fixed before moving on to more your obviously more complicated version. &lt;BR /&gt;&lt;BR /&gt;This is exactly why it is better to set up Oracle or other environments in a location like /usr/local/bin/oraenv.sh and then include them&lt;BR /&gt;in your .profiles via . /usr/local/bin/oraenv.sh.&lt;BR /&gt;&lt;BR /&gt;You could then simply do an su username -c somescript and somescript also includes /usr/local/bin/oraenv.sh.&lt;BR /&gt;&lt;BR /&gt;I think you can get your existing profiles to work,it's just more difficult this way.&lt;BR /&gt;&lt;BR /&gt;Clay&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Jul 2001 17:22:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problems-with-nohup/m-p/2552474#M917567</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-13T17:22:39Z</dc:date>
    </item>
  </channel>
</rss>

