<?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: shell script challenge regarding background/prompt/pipe in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148297#M900830</link>
    <description>Suspect your program does a close(0) and then opens another fd for reading.&lt;BR /&gt;&lt;BR /&gt;Unless you know which fd this is, or have the patience to keep trying&lt;BR /&gt;&lt;BR /&gt;nohup EXECUTABLE 3nohup EXECUTABLE 4&lt;BR /&gt;etc up to 20,&lt;BR /&gt;&lt;BR /&gt;then I'd give up if I were you...&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
    <pubDate>Thu, 18 Dec 2003 10:26:29 GMT</pubDate>
    <dc:creator>Graham Cameron_1</dc:creator>
    <dc:date>2003-12-18T10:26:29Z</dc:date>
    <item>
      <title>shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148287#M900820</link>
      <description>Hey experts.  Is it as slow in the US as it is here in the UK now (just before Christmas)?&lt;BR /&gt;&lt;BR /&gt;Anway, points for the genius who can make sense of the quagmire of concepts involved scripting the equivalent of pressing return at the end of a command which runs in background.&lt;BR /&gt;&lt;BR /&gt;I need to run a script to start up a program after Omniback finishes a backup.  We do this all the time here, but this time the program runs in background and the script doesn't return the prompt (return code?) therefore omniback thinks the script has failed when it eventually reaches it's timeout.  &lt;BR /&gt;&lt;BR /&gt;Running the script interactively I can see that it's kicked off the background process, e even echoes stuff which I stuck in AFTER the bg process.  However, it doesn't give me the prompt back until I press return.&lt;BR /&gt;&lt;BR /&gt;So, if I could send "^M" or echo "" or something similar, then connect it to the offending program with a pipe or "&amp;lt;" or something, I'd be in business.&lt;BR /&gt;&lt;BR /&gt;I've looked up googlegroups and found some interesting discussions, but nothing which addressed my problem (either directly or indirectly). &lt;BR /&gt;&lt;BR /&gt;I've tried stuff like:&lt;BR /&gt;&lt;BR /&gt;echo ^M | nohup EXECUTABLE &amp;amp;&lt;BR /&gt;( echo ^M | nohup EXECUTABLE &amp;amp; )&lt;BR /&gt;echo "" | nohup EXECUTABLE &amp;amp; &lt;BR /&gt;echo "" | (nohup EXECUTABLE ) &amp;amp;&lt;BR /&gt;nohup EXECUTABLE &amp;amp; &amp;lt; echo ""&lt;BR /&gt;nohup EXECUTABLE &amp;amp; | xargs echo ""&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm gonna be left with no choice but to take this bit o' background code out of the post-exec Omniback script and instead put it in a separate cron-job.  This is untidy and not what I really wanna settle for.&lt;BR /&gt;&lt;BR /&gt;So, I've come here... To the Great Source of all Knowledge and Wisdom!&lt;BR /&gt;&lt;BR /&gt;cheers,&lt;BR /&gt;Kevin</description>
      <pubDate>Thu, 18 Dec 2003 09:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148287#M900820</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-18T09:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148288#M900821</link>
      <description>Have you tried this:&lt;BR /&gt;&lt;BR /&gt;nohup EXECUTABLE &lt;TMPF&gt;&lt;/TMPF&gt;&lt;BR /&gt;where tmpf contains an empty line?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 09:47:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148288#M900821</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-12-18T09:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148289#M900822</link>
      <description>nohup EXECUTABLE &lt;BR /&gt;-- Graham</description>
      <pubDate>Thu, 18 Dec 2003 09:47:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148289#M900822</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-18T09:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148290#M900823</link>
      <description>I imagine that if you had a wrapper script as your omniback postexec command that ran the real script in the background you'd be OK.&lt;BR /&gt; &lt;BR /&gt;omnibackpostexec script would do soemthing like this&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;nohup script2 &amp;amp;&lt;BR /&gt;exit 0&lt;BR /&gt; &lt;BR /&gt;If you really want to go mad you need to fork and exit and for that, lets do perl.&lt;BR /&gt;&lt;BR /&gt;Your omniback post exec script would look like&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;$PID=fork;&lt;BR /&gt;if($pid != 0){&lt;BR /&gt; exit 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;`/my/shell/script/here`;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Of course, if you fancy doing your script in perl, then you don't need to run that shell script at the bottom.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 09:50:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148290#M900823</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-18T09:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148291#M900824</link>
      <description>Elmar &amp;amp; Graham, tried it but no success.&lt;BR /&gt;Mark, tried the first suggestion, still no-go.  I'd be interested in trying a fork in shell script, but don't really wanna use perl.</description>
      <pubDate>Thu, 18 Dec 2003 09:56:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148291#M900824</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-18T09:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148292#M900825</link>
      <description>Kevin,&lt;BR /&gt; &lt;BR /&gt;I don't think you can "fork" in a shell but A.Clay Stephenson is dropping his scripting bombs again today so he may well prove me wrong!&lt;BR /&gt; &lt;BR /&gt;Your problem is not the second command (though if it were written correctly you wouldn't have this problem) but the shell that is running it.  This is why I can't quite understand why the first option I suggested doesn't work.&lt;BR /&gt; &lt;BR /&gt;However, that perl thing will do nicely as an omniback post exec script (I do something similar myself) and you'll never have to touch perl aain if you didn't want to :)</description>
      <pubDate>Thu, 18 Dec 2003 10:03:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148292#M900825</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-18T10:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148293#M900826</link>
      <description>much, much simpler...&lt;BR /&gt;&lt;BR /&gt;nohup (EXECUTABLE &amp;lt;&amp;lt; EOF&lt;BR /&gt;&lt;BR /&gt;EOF) &amp;amp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  Massimo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 10:04:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148293#M900826</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-18T10:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148294#M900827</link>
      <description>EXECUTABLE: Syntax error at line 1 : `(' is not expected.</description>
      <pubDate>Thu, 18 Dec 2003 10:09:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148294#M900827</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-18T10:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148295#M900828</link>
      <description>this program must be way-dodgy.  I've wrapped up the program and flags/parameters into one script, executed it within another one, using Massimo's suggestion, but still it's a no-go. &lt;BR /&gt;&lt;BR /&gt;Thanks everyone.  Maybe i'll try the perl option afterall...  back soon. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 10:18:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148295#M900828</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-18T10:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148296#M900829</link>
      <description>Let's tear away the parentesis:&lt;BR /&gt;&lt;BR /&gt;####################&lt;BR /&gt;EXECUTABLE:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;&lt;BR /&gt;do_something &amp;lt;&amp;lt; EOF&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;#######################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;nohup EXECUTABLE &amp;amp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Massimo</description>
      <pubDate>Thu, 18 Dec 2003 10:24:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148296#M900829</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-18T10:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148297#M900830</link>
      <description>Suspect your program does a close(0) and then opens another fd for reading.&lt;BR /&gt;&lt;BR /&gt;Unless you know which fd this is, or have the patience to keep trying&lt;BR /&gt;&lt;BR /&gt;nohup EXECUTABLE 3nohup EXECUTABLE 4&lt;BR /&gt;etc up to 20,&lt;BR /&gt;&lt;BR /&gt;then I'd give up if I were you...&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Thu, 18 Dec 2003 10:26:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148297#M900830</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-18T10:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148298#M900831</link>
      <description>&lt;BR /&gt;mkfifo fifo&lt;BR /&gt;nohup EXECUTABLE &lt;FIFO&gt;&lt;/FIFO&gt;echo "^M" &amp;gt;fifo</description>
      <pubDate>Fri, 19 Dec 2003 05:44:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148298#M900831</guid>
      <dc:creator>BIHAN</dc:creator>
      <dc:date>2003-12-19T05:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148299#M900832</link>
      <description>missing an &amp;amp; at the end of the nohup line&lt;BR /&gt;&lt;BR /&gt;i think&lt;BR /&gt;echo &amp;gt; fifo &lt;BR /&gt;would be better than &lt;BR /&gt;echo "^M" &amp;gt;fifo</description>
      <pubDate>Fri, 19 Dec 2003 05:49:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148299#M900832</guid>
      <dc:creator>BIHAN</dc:creator>
      <dc:date>2003-12-19T05:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148300#M900833</link>
      <description>Kevin,&lt;BR /&gt;&lt;BR /&gt;How about posting this script so that we can have a look at it?&lt;BR /&gt;&lt;BR /&gt;JL</description>
      <pubDate>Fri, 19 Dec 2003 08:35:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148300#M900833</guid>
      <dc:creator>James Lynch</dc:creator>
      <dc:date>2003-12-19T08:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148301#M900834</link>
      <description>The real issue is the EXECUTABLE, which is part of Oracle Applications 11i Server, and is over 6 megabytes in size.  Probably not the best idea to post (I expect it wouldn't run without the other bits of code that make up the Oracle installation.&lt;BR /&gt;&lt;BR /&gt;Thanks everyone, but I think I'll just have to use cron to restart this bit and keep it out of Omniback post-exec alltogether.&lt;BR /&gt;&lt;BR /&gt;cheers</description>
      <pubDate>Fri, 19 Dec 2003 09:12:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148301#M900834</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-19T09:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148302#M900835</link>
      <description>Kevin,&lt;BR /&gt;&lt;BR /&gt;If you are just trying to answer a prompt that the application requires, and it's a carriage return, I've done it as such:&lt;BR /&gt;echo "\013" | APPLICATION &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;This works for me in a script that runs an Informix backup procedure, which is normally interactive.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mark</description>
      <pubDate>Fri, 19 Dec 2003 09:51:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148302#M900835</guid>
      <dc:creator>Mark Ellzey</dc:creator>
      <dc:date>2003-12-19T09:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148303#M900836</link>
      <description>Amazing, I've tried every suggestion listed above, and the last one... finally... worked!&lt;BR /&gt;&lt;BR /&gt;cheers Mark!&lt;BR /&gt;&lt;BR /&gt;(I can always count on ITRC Geniuses)</description>
      <pubDate>Fri, 19 Dec 2003 10:03:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148303#M900836</guid>
      <dc:creator>Kevin_31</dc:creator>
      <dc:date>2003-12-19T10:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148304#M900837</link>
      <description>No points here... &lt;BR /&gt;&lt;BR /&gt;I just want to say I enjoyed reading this puzzle...&lt;BR /&gt;&lt;BR /&gt;We need more posts like this to test our brains power.&lt;BR /&gt;&lt;BR /&gt;I personally troll the boards to educate myself... and posts like this are helping.</description>
      <pubDate>Fri, 19 Dec 2003 11:09:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148304#M900837</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-12-19T11:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: shell script challenge regarding background/prompt/pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148305#M900838</link>
      <description>... sorry to be late due to my timezone! A useful trick to communicate with a background process works like this:&lt;BR /&gt;&lt;BR /&gt;1st: You start the background job:&lt;BR /&gt;  bgjob 2&amp;gt;&amp;amp;1 1&amp;gt;logfile |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;2nd: You retrieve the background job's stderr output (error messages, prompts, etc.):&lt;BR /&gt;  read -p $bg_output&lt;BR /&gt;&lt;BR /&gt;3rd: You send data to the background job's stdin:&lt;BR /&gt;  bg_input="some_input"&lt;BR /&gt;  print -p -R $bg_input&lt;BR /&gt;&lt;BR /&gt;This works with POSIX-compatible shells, e.g., /usr/bin/sh and /usr/bin/ksh, but not with bash.&lt;BR /&gt;&lt;BR /&gt;I hope this is useful for you.</description>
      <pubDate>Tue, 23 Dec 2003 07:43:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-challenge-regarding-background-prompt-pipe/m-p/3148305#M900838</guid>
      <dc:creator>Ulrich Deiters</dc:creator>
      <dc:date>2003-12-23T07:43:19Z</dc:date>
    </item>
  </channel>
</rss>

