- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Wait command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 12:34 AM
07-26-2006 12:34 AM
Below is my requirement,
1: Connect Oracle , Run a SQL (which takes 3-4 hours to build the extract file).
2: Wait for extract to be completed (above step)
3:copy extract file to someother location.
4:exit
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 ?
Thanks .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 12:47 AM
07-26-2006 12:47 AM
SolutionIf 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.
You could also do the commands joined by &&, which will wait until the first command finishes before executing the second -- eg.
sqlplus "user/passwd" < myscript.sql && cp resultfile /somewhere/else
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 12:52 AM
07-26-2006 12:52 AM
Re: Wait command
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.
If you have launched a background process, I'd capture its pid from '$!' and then wait using that pid, for example:
...
do_something &
PID_OF_THING = $!
...
wait ${PID_OF_THING}
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 02:08 AM
07-26-2006 02:08 AM
Re: Wait command
if you use the form 'wait pid', you'll get the exit status of the background command, e.g.:
..
backcmd &
...
wait $!
if [ $? -gt 0 ]
then print -u2 backcmd failed
fi
...
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 02:16 AM
07-26-2006 02:16 AM
Re: Wait command
You can also perform the copy operation from your PL/SQL script by shelling to the OS:
begin
--Perform extract here
if --Extract completed successfully
then
host cp /dir1/* /dir2;
end if;
end;
/
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 03:07 AM
07-26-2006 03:07 AM
Re: Wait command
BTW, good posting from the new guy (Jonathan) - keep it up!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 08:19 PM
07-26-2006 08:19 PM
Re: Wait command
#!/usr/bin/sh
export ORACLE_SID=sidname
export ORAENV_ASK=NO
. oraenv
unset ORAENV_ASK
sqlplus user/password <
exit
EOF
cp file_name_from_script /dir/filesys/newloc
exit
Dave