10-21-2002
Help with wait command
I have a script that runs numerous other scripts. I am using a wait command to try and get the calling script to wait for all process called to finish before proceeding.
Issues
How can I set wait to timeout IE a called program never terminates.
Alternatively how can I check the called process and then decide to kill them if they have gone past as set time reference. So the calling script can continue.
I am finding sometimes wait never terminates and other times it terminates prematurely.
Thanks
![Big Grin Smilie](https://www.unix.com/images/smilies/biggrin.gif)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Does anyone have an example of a korn shell scripts kicking of multiple background processes and then using the wait command to get the return code from those processes?
I want to write a program that kicks off multiple Oracle procedures and then wait for the return code before I procede.... (1 Reply)
Discussion started by: lesstjm
1 Replies
2. Shell Programming and Scripting
Did not use 'wait' yet.
How I understand by now the wait works only for child processes, started background.
Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?)
I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies
3. Shell Programming and Scripting
Hi All,
I have a script which runs 3 scripts. The first script creates two files. The other two scripts should run only when the files are created.
I tried the following for loop , but it is not working. Can someone please help me.
while ; do
# Sleep until file does exists/is created... (4 Replies)
Discussion started by: nua7
4 Replies
4. Shell Programming and Scripting
Hi all,
After expect catches the string I specify, is there a way to ask expect wait for sometime before running the next send command ?
So my script looks like following,
expect "some string"
#How to ask expect to wait for a while
send "next command"
The reason I want to do this is... (0 Replies)
Discussion started by: qiulang
0 Replies
5. Shell Programming and Scripting
Hi all,
I have never used the wait command before and want to know how it works.
I basically need to run four sqlplus sessions in parallel as background processes and i am spooling the results obtained from the database into files.I need to wait for all the processes to finish and then make... (2 Replies)
Discussion started by: vinoo128
2 Replies
6. Shell Programming and Scripting
Hi, Is there any way to know the child process status as and when it finished. If i write like below
nohup sh a1.sh & ### has sleep 20 ;echo a1.sh
nohup sh a2.sh & ### has sleep 10 ;echo a2.sh
nohup sh a3.sh & ### has sleep 5 ;echo a3.sh
wait
This will wait till a1.sh ,a2.sh a3.sh... (0 Replies)
Discussion started by: patrickk
0 Replies
7. UNIX for Dummies Questions & Answers
When running a command using the >(cmd) syntax in bash how do you wait for the command to complete before moving on in your script?
Here is a simple example:
zcat largefile.gz | tee >(wc && echo “HELLO”) > /dev/null
# I tried wait, here but it doesn't wait for the process in the subshell.... (8 Replies)
Discussion started by: mrvwman
8 Replies
8. Shell Programming and Scripting
Hi All,
I have a question related to Shell scripting. In my shell script, I have following two commands in sequence:
sed 's/^/grep "^120" /g' $ORIGCHARGEDAMTLIST|sed "s;$;| cut -f$FIELD_NO1 -d '|' | awk '{ sum+=\$1} END {printf (\"%0.2f\\\n\", sum/100)}' >$TEMPFILE
mv $TEMPFILE $ORIGFILE... (3 Replies)
Discussion started by: angshuman
3 Replies
9. Shell Programming and Scripting
I am trying to write a korn shell script (Z.ksh) that will execute three other korn shell scripts within it. The three korn shell scripts (A.ksh,B.ksh,C.ksh) each execute a series of .sas programs. A.ksh, B.ksh, and C.ksh must each wait until the last .sas program within them executes and finishes... (2 Replies)
Discussion started by: imoore
2 Replies
10. Shell Programming and Scripting
while read list
do
nohup ./process.sh $list &
process_id=$!
wait $process_id
done < sample.lst
command1..
command2..
//Am calling a shell script within and firing the multiple processes concurrently. (8 Replies)
Discussion started by: manid
8 Replies
LEARN ABOUT HPUX
pthread_exit
pthread_exit(3T) pthread_exit(3T)
NAME
pthread_exit() - cause the calling thread to terminate
SYNOPSIS
PARAMETERS
value_ptr The calling thread's exit status.
DESCRIPTION
terminates the calling thread. The calling thread returns an exit status in value_ptr. This value is returned to a joining thread calling
on the terminating thread. Only threads created with the detachstate attribute value can return an exit status to The exit status of a
detached thread is lost when the thread terminates.
When a thread terminates, process-shared resources are not released. Examples of process-shared resources include mutexes, condition vari-
ables, semaphores, message queue descriptors, and file descriptors. The routines are not called when a thread terminates as this is a
process termination action.
An implicit call to is made when a thread returns from its start routine. The function's return value serves as the thread's exit status
(see pthread_create(3T)). If the main thread returns from without calling the process will exit using the return value from as the exit
status. If the main thread calls the process will continue executing until the last thread terminates or a thread calls After the last
thread in the process terminates, the process will exit with an exit status of zero.
Any installed cancellation cleanup handlers will be popped and executed in the reverse order that they were installed. After the cancella-
tion cleanup handlers have been executed, if the thread has any non-NULL thread-specific data values with associated destructor functions,
the destructor functions are called. The order in which these destructor functions are called is unspecified.
Calling from a cancellation cleanup handler or destructor function that was invoked because of thread termination results in undefined
behavior.
After a thread has terminated, the result of access to local (auto) variables of the thread is undefined. The terminating thread should
not use local variables for the value_ptr parameter value.
RETURN VALUE
None.
ERRORS
None, this function does not return.
AUTHOR
was derived from the IEEE POSIX P1003.1c standard.
SEE ALSO
pthread_create(3T), pthread_join(3T), exit(2), wait(2).
STANDARDS CONFORMANCE
Pthread Library pthread_exit(3T)