<?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: nohup an su command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175472#M321748</link>
    <description>Thanks Dennis - still no output - shucks!</description>
    <pubDate>Thu, 10 Apr 2008 17:47:53 GMT</pubDate>
    <dc:creator>Jay Core</dc:creator>
    <dc:date>2008-04-10T17:47:53Z</dc:date>
    <item>
      <title>nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175465#M321741</link>
      <description>Alright everyone - easy pointage opportunity!&lt;BR /&gt;&lt;BR /&gt;I'm trying to nohup, su, and then run a command and write it to a file - but no luck.  Here's what I'm doing:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/nohup "/usr/bin/su oracle -c uptime" 2&amp;gt;&amp;amp;1 &amp;gt; /tmp/oratmp.txt &amp;amp;&lt;BR /&gt;&lt;BR /&gt;I want the results of uptime to be written to /tmp/oratmp.txt - but it doesn't even get created.&lt;BR /&gt;What is my major malfunction?&lt;BR /&gt;&lt;BR /&gt;Thanks all!&lt;BR /&gt;JC</description>
      <pubDate>Mon, 07 Apr 2008 21:07:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175465#M321741</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-07T21:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175466#M321742</link>
      <description>One problem is with the order of your redirection statements. 2&amp;gt;&amp;amp;1 says redirect the output of stderr to your stdout device, in this the terminal. The next: &amp;gt; /tmp... says change stdout to go the file. But stderr is not going to the file. The correct order is to redirect file descriptor 1 before you refer to that file descriptor, like this:&lt;BR /&gt; &lt;BR /&gt;&amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt; &lt;BR /&gt;Now the file descriptor 1 will be assigned to the filename and descriptor 2 will use what descriptor 1 is using.&lt;BR /&gt; &lt;BR /&gt;/usr/bin/nohup and /usr/bin/su are OK ways to ensure your PATH doesn't pickup a rogue copy of the desired program but you have to be consistent (ie, /usr/bin/uptime). But a much better way to handle $PATH is to set it on the command line:&lt;BR /&gt; &lt;BR /&gt;PATH=/usr/bin nohup su oracle -c uptime &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt; &lt;BR /&gt;The assignment of PATH on the command line is temporary so it doesn't affect your current $PATH value. For scripts, I always start with:&lt;BR /&gt; &lt;BR /&gt;export PATH=/usr/bin&lt;BR /&gt; &lt;BR /&gt;and then add additional paths as required. That way, my standalone scripts never inherit an unknown $PATH and run the wrong command.</description>
      <pubDate>Mon, 07 Apr 2008 21:59:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175466#M321742</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-04-07T21:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175467#M321743</link>
      <description>Hi,&lt;BR /&gt;use this:&lt;BR /&gt;/usr/bin/nohup "/usr/bin/su oracle -c uptime"&amp;gt;&amp;gt; /tmp/oratmp.txt &amp;amp;&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;&lt;BR /&gt;Aashique&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Apr 2008 23:37:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175467#M321743</guid>
      <dc:creator>Aashique</dc:creator>
      <dc:date>2008-04-07T23:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175468#M321744</link>
      <description>Thanks Bill and Aashique,&lt;BR /&gt;&lt;BR /&gt;I really appreciate the feedback, but I'm still coming up with an empty file.&lt;BR /&gt;&lt;BR /&gt;Things that make you go HMMM?</description>
      <pubDate>Tue, 08 Apr 2008 13:30:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175468#M321744</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-08T13:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175469#M321745</link>
      <description>&amp;gt;Aashique: use this:&lt;BR /&gt;/usr/bin/nohup "/usr/bin/su oracle -c uptime"&amp;gt;&amp;gt; /tmp/oratmp.txt &amp;amp;&lt;BR /&gt;&lt;BR /&gt;This doesn't look right but may work?  The syntax for nohup is:&lt;BR /&gt;nohup command arguments&lt;BR /&gt;If you quote it, it is all one "command".&lt;BR /&gt;You would have to use tusc to see what's happening.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but I'm still coming up with an empty file.&lt;BR /&gt;&lt;BR /&gt;You may need to use tusc to see what's happening.&lt;BR /&gt;&lt;BR /&gt;You can also break up the command into a script:&lt;BR /&gt;nohup script &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;And in the script use:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;su oracle -c "uptime"&lt;BR /&gt;&lt;BR /&gt;With a script you can add echo and "set -x" to debug.</description>
      <pubDate>Wed, 09 Apr 2008 05:59:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175469#M321745</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-09T05:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175470#M321746</link>
      <description>Thanks Dennis.  The problem is that I cannot invoke a script in the command, and I cannot use tusc - thanks asnyway.</description>
      <pubDate>Wed, 09 Apr 2008 19:06:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175470#M321746</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-09T19:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175471#M321747</link>
      <description>&amp;gt;The problem is that I cannot invoke a script in the command, and I cannot use tusc.&lt;BR /&gt;&lt;BR /&gt;You use these only for debugging.&lt;BR /&gt;&lt;BR /&gt;I had no problems doing this from root:&lt;BR /&gt;# nohup su xxxxxx -c "uptime" &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;So your original problem had to do with quoting the nohup options and your incorrect order of redirections.</description>
      <pubDate>Wed, 09 Apr 2008 22:22:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175471#M321747</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-09T22:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175472#M321748</link>
      <description>Thanks Dennis - still no output - shucks!</description>
      <pubDate>Thu, 10 Apr 2008 17:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175472#M321748</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-10T17:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175473#M321749</link>
      <description>&amp;gt;still no output&lt;BR /&gt;&lt;BR /&gt;I'm not sure why?&lt;BR /&gt;&lt;BR /&gt;What do you get for:&lt;BR /&gt;/usr/bin/nohup /usr/bin/su oracle -c "/usr/bin/uptime"</description>
      <pubDate>Thu, 10 Apr 2008 19:22:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175473#M321749</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-10T19:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175474#M321750</link>
      <description>Hey Dennis,&lt;BR /&gt;&lt;BR /&gt;still nothing.  Sorry, and thanks for your efforts.&lt;BR /&gt;&lt;BR /&gt;JC</description>
      <pubDate>Mon, 14 Apr 2008 13:15:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175474#M321750</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-14T13:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175475#M321751</link>
      <description>&amp;gt;still nothing.&lt;BR /&gt;&lt;BR /&gt;I assume you are root and your shell is /sbin/sh and the user oracle exists?</description>
      <pubDate>Mon, 14 Apr 2008 22:22:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175475#M321751</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-14T22:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175476#M321752</link>
      <description>&amp;gt; still nothing. &lt;BR /&gt; &lt;BR /&gt;How about just the basics? Start with:&lt;BR /&gt; &lt;BR /&gt;/usr/bin/su - oracle&lt;BR /&gt;uptime&lt;BR /&gt; &lt;BR /&gt;Notice the "-" with su? Unless you are very familiar with using su without the "-", always use su - so your session inherits the correct environment.&lt;BR /&gt; &lt;BR /&gt;If the above works OK, now try it with PARTIAL redirection:&lt;BR /&gt; &lt;BR /&gt;/usr/bin/su - oracle -c uptime &amp;gt; /tmp/oratmp.txt&lt;BR /&gt; &lt;BR /&gt;The reason for partial is that you need to see the errors in case /tmp/oratmp.txt is causing a problem. (perhaps there is an existing file called oratmp.txt but owned by root and allowing no write access) Because stderr is redirected to stdout, failure to create the temp file will be invisible because the error message cannot be written out.&lt;BR /&gt; &lt;BR /&gt;Now the same with complete redirection:&lt;BR /&gt; &lt;BR /&gt;/usr/bin/su - oracle -c uptime &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt; &lt;BR /&gt;This should produce the desired output. Now remove the output file so you can see if it gets created again in the background:&lt;BR /&gt; &lt;BR /&gt;rm /tmp/oratmp.txt&lt;BR /&gt;/usr/bin/su - oracle -c uptime &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt; &lt;BR /&gt;And if that works OK, try it with nohup as a last step:&lt;BR /&gt; &lt;BR /&gt;rm /tmp/oratmp.txt&lt;BR /&gt;/usr/bin/nohup /usr/bin/su - oracle -c uptime &amp;gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt; &lt;BR /&gt;Another way to troubleshoot this would be to just remove the stderr redirection:&lt;BR /&gt; &lt;BR /&gt;rm /tmp/oratmp.txt&lt;BR /&gt;/usr/bin/nohup /usr/bin/su - oracle -c uptime &amp;gt; /tmp/oratmp.txt &amp;amp;&lt;BR /&gt; &lt;BR /&gt;Then look in the local file nohup.out. It will contain any stderr problems.</description>
      <pubDate>Mon, 14 Apr 2008 23:19:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175476#M321752</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-04-14T23:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175477#M321753</link>
      <description>Dennis - yes to both - thanks.&lt;BR /&gt;&lt;BR /&gt;Bill - wow - thanks for the insight - I'll check it out and let you know - Thanks!</description>
      <pubDate>Wed, 16 Apr 2008 02:06:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175477#M321753</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-16T02:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175478#M321754</link>
      <description>Hi Bill - still having weirdo problems:&lt;BR /&gt;&lt;BR /&gt;&lt;HOW about="" just="" the="" basics=""&gt;&lt;/HOW&gt;&lt;UPTIME&gt;&lt;/UPTIME&gt;&lt;BR /&gt;This worked as expected&lt;BR /&gt;____________________________________________&lt;BR /&gt;&lt;BR /&gt;&lt;IF the="" above="" works="" ok=""&gt; /tmp/oratmp.txt&lt;BR /&gt;&lt;BR /&gt;This worked as expected, writing the "su - oracle" output and the "uptime" output to the file, although there were some control characters in there between the two command outputs, shown here: ^[[3g        ^[H        ^[H        ^[H        ^[H        ^[H&lt;BR /&gt;        ^[H        ^[H        ^[H        ^[HCOLUMNS=80&lt;BR /&gt;____________________________________________&lt;BR /&gt;&lt;BR /&gt;&lt;NOW the="" same="" with="" complete=""&gt;&lt;/NOW&gt;&lt;/IF&gt; &lt;BR /&gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;This worked as expected also, writing the "su - oracle" output and the "uptime" output to the file, although there were some control characters in there between the two command outputs as above, and also the statement: "not a terminal"&lt;BR /&gt;___________________________________________&lt;BR /&gt;&lt;NOW remove="" the="" output="" file="" so="" you="" can="" see=""&gt;&lt;/NOW&gt;&lt;RM&gt;&lt;/RM&gt;&lt;BR /&gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This appeared to hang, until I hit the return key twice, and it gave it a sigterm kill.  There was an empty output file generated.&lt;BR /&gt;____________________________________________&lt;BR /&gt;&lt;AND if="" that="" works="" ok=""&gt;&lt;/AND&gt;&lt;RM&gt;&lt;/RM&gt; /tmp/oratmp.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;This also appeared to hang, until I hit the return key twice, and it gave it a sigterm kill.  There was an empty output file generated.&lt;BR /&gt;____________________________________________&lt;BR /&gt;&lt;BR /&gt;&lt;ANOTHER way="" to="" troubleshoot="" this="" would="" be=""&gt;&lt;/ANOTHER&gt;&lt;RM&gt;&lt;/RM&gt; /tmp/oratmp.txt &amp;amp;&lt;BR /&gt;&lt;THEN look="" in="" the="" local="" file="" nohup.out.="" it=""&gt;&lt;/THEN&gt;&lt;BR /&gt;This also appeared to hang, until I hit the return key twice, and it gave it a sigterm kill.  There was an empty output file generated, and there wasn't any nohup.out file created.&lt;BR /&gt;____________________________________________&lt;BR /&gt;&lt;BR /&gt;Sorry to keep bugging - any other ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;JC&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2008 22:15:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175478#M321754</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2008-04-22T22:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175479#M321755</link>
      <description>&amp;gt;Sorry to keep bugging - any other ideas?&lt;BR /&gt;&lt;BR /&gt;It's all obvious now.  What shell are you using?  If you are using the scummy C shell, I've had that hang happen!&lt;BR /&gt;&lt;BR /&gt;You need to go through every stinkin' line of /etc/profile, ~/.profile, .login, .cshrc etc to make sure all tty commands are conditioned out if you aren't on a tty.&lt;BR /&gt;&lt;BR /&gt;These shouldn't be there:&lt;BR /&gt;&amp;gt;some control characters in there between the two command outputs, shown here: ^[[3g ^[H ^[H ^[H ^[H ^[H^[H ^[H ^[H ^[HCOLUMNS=80&lt;BR /&gt;&amp;gt;also the statement: "not a terminal"&lt;BR /&gt;&amp;gt;This appeared to hang,&lt;BR /&gt;&lt;BR /&gt;See Bill's comments about evil tty stuff in these links:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1155618" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1155618&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1206345" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1206345&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1146959" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1146959&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1132303" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1132303&lt;/A&gt;</description>
      <pubDate>Tue, 22 Apr 2008 23:26:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175479#M321755</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-22T23:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: nohup an su command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175480#M321756</link>
      <description>&amp;gt; This worked as expected, writing the "su - oracle" output and the "uptime" output to the file, although there were some control characters in there between the two command outputs, shown here: ^[[3g ^[H ^[H ^[H ^[H ^[H&lt;BR /&gt;^[H ^[H ^[H ^[HCOLUMNS=80&lt;BR /&gt; &lt;BR /&gt;Your oracle login is messed up bad with hardcoded TERM values and interactive terminal commands. You have to fix the oracle .profile to bypass terminal commands when running in batch -- as mentioned before.</description>
      <pubDate>Wed, 23 Apr 2008 12:21:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nohup-an-su-command/m-p/4175480#M321756</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-04-23T12:21:25Z</dc:date>
    </item>
  </channel>
</rss>

