<?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: Wait command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831090#M778886</link>
    <description>Hi, I would suggest you do something like this. Create a script as follows&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export ORACLE_SID=sidname&lt;BR /&gt;export ORAENV_ASK=NO&lt;BR /&gt;. oraenv&lt;BR /&gt;unset ORAENV_ASK&lt;BR /&gt;&lt;BR /&gt;sqlplus user/password &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;@file_to_generate_outfile&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;cp file_name_from_script /dir/filesys/newloc&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;Dave</description>
    <pubDate>Thu, 27 Jul 2006 03:19:45 GMT</pubDate>
    <dc:creator>Dave Walley</dc:creator>
    <dc:date>2006-07-27T03:19:45Z</dc:date>
    <item>
      <title>Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831084#M778880</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Below is my requirement, &lt;BR /&gt;&lt;BR /&gt;1: Connect Oracle , Run a SQL (which takes 3-4 hours to build the extract file).&lt;BR /&gt;&lt;BR /&gt;2: Wait for extract to be completed (above step)&lt;BR /&gt;&lt;BR /&gt;3:copy extract file to someother location.&lt;BR /&gt;&lt;BR /&gt;4:exit&lt;BR /&gt;&lt;BR /&gt;I'm more concerned about Step 2:"Wait". I'm just using the "Wait" command and it works fine. Is this enough ? or i need to include PID for wait command ? also is there any restrictions for Wait command? i remember reading it may clash with foreground/background processes if too many are running etc...i'm worried because it shouldnt goto copy step until step 2 finishes. How to make sure ? &lt;BR /&gt;&lt;BR /&gt;Thanks .&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Jul 2006 07:34:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831084#M778880</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-07-26T07:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831085#M778881</link>
      <description>If you have more than one background process spawned by the current shell, wait will wait until they have all completed. &lt;BR /&gt;&lt;BR /&gt;If that is a risk for your script, try doing step 1 and then using the $! variable to grab the pid of the process in step 1, and using that as an argument for wait.&lt;BR /&gt;&lt;BR /&gt;You could also do the commands joined by &amp;amp;&amp;amp;, which will wait until the first command finishes before executing the second -- eg. &lt;BR /&gt;&lt;BR /&gt;sqlplus "user/passwd" &amp;lt; myscript.sql &amp;amp;&amp;amp; cp resultfile /somewhere/else</description>
      <pubDate>Wed, 26 Jul 2006 07:47:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831085#M778881</guid>
      <dc:creator>Jonathan Fife</dc:creator>
      <dc:date>2006-07-26T07:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831086#M778882</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I assume that we are speaking of a shell script.  Therefore, it is sufficient to simply specify 'wait' without a pid if your process structure is single-threaded.  If you have multiple processes running, a simple 'wait' will wait until all of them have finished.&lt;BR /&gt;&lt;BR /&gt;If you have launched a background process, I'd capture its pid from '$!' and then wait using that pid, for example:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;do_something &amp;amp;&lt;BR /&gt;PID_OF_THING = $!&lt;BR /&gt;...&lt;BR /&gt;wait ${PID_OF_THING}&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 26 Jul 2006 07:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831086#M778882</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-26T07:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831087#M778883</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if you use the form 'wait pid', you'll get the exit status of the background command, e.g.:&lt;BR /&gt;&lt;BR /&gt;..&lt;BR /&gt;backcmd &amp;amp;&lt;BR /&gt;&lt;MORE commands=""&gt;&lt;BR /&gt;...&lt;BR /&gt;wait $!&lt;BR /&gt;if [ $? -gt 0 ]&lt;BR /&gt;then print -u2 backcmd failed&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;/MORE&gt;</description>
      <pubDate>Wed, 26 Jul 2006 09:08:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831087#M778883</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-26T09:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831088#M778884</link>
      <description>&lt;!--!*#--&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;You can also perform the copy operation from your PL/SQL script by shelling to the OS:&lt;BR /&gt;&lt;BR /&gt;begin&lt;BR /&gt;--Perform extract here&lt;BR /&gt;if --Extract completed successfully&lt;BR /&gt;then&lt;BR /&gt;  host cp /dir1/* /dir2;&lt;BR /&gt;end if;&lt;BR /&gt;end;&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Wed, 26 Jul 2006 09:16:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831088#M778884</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-07-26T09:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831089#M778885</link>
      <description>spex is right, his suggested method would avoid the whole problem of having to wait with a shell script, the sql job itself could handle the extract and perform the copy for you if that works for you.  Of course, I could see a multitude of reasons why it wouldn't be, among them you don't want to mess with the code for the extract for each possible landing spot it may or may not have to go to...&lt;BR /&gt;&lt;BR /&gt;BTW, good posting from the new guy (Jonathan) - keep it up!</description>
      <pubDate>Wed, 26 Jul 2006 10:07:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831089#M778885</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-07-26T10:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Wait command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831090#M778886</link>
      <description>Hi, I would suggest you do something like this. Create a script as follows&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export ORACLE_SID=sidname&lt;BR /&gt;export ORAENV_ASK=NO&lt;BR /&gt;. oraenv&lt;BR /&gt;unset ORAENV_ASK&lt;BR /&gt;&lt;BR /&gt;sqlplus user/password &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;@file_to_generate_outfile&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;cp file_name_from_script /dir/filesys/newloc&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Thu, 27 Jul 2006 03:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wait-command/m-p/3831090#M778886</guid>
      <dc:creator>Dave Walley</dc:creator>
      <dc:date>2006-07-27T03:19:45Z</dc:date>
    </item>
  </channel>
</rss>

