Computing.Net > Forums > Unix > Question about parent-child process

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Question about parent-child process

Reply to Message Icon

Name: nauj
Date: March 11, 2005 at 09:49:12 Pacific
OS: AIX 5.1
Comment:

Hi,

I have two AIX ksh scripts: script1.sh, script2.sh

Into script1.sh I make a call to script2.sh

. $HOME/script2.sh &

I want that script2.sh executes in background mode (child process of script1).

But I want that when script1 finish, script2 finish too. is that possible??

How do I have to make the call to script2 in order to finish when script2 finish.

Do I have to use signals to order script2 finishing???

Any advice will be greatly aprecciatted.

Nauj




Sponsored Link
Ads by Google

Response Number 1
Name: Jim Boothe
Date: March 11, 2005 at 11:43:19 Pacific
Reply:

One way would be to have script2.sh continue to watch for presence of the parent process ID:

parent=$PPID
while true
do
if [ $(ps -ef|awk '$2=="'$PPID'"'|wc -l) -eq 0 ] ; then
break
fi
sleep 3
done


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Question about parent-child process

Father and Child process problem www.computing.net/answers/unix/father-and-child-process-problem/3047.html

Number of child process www.computing.net/answers/unix/number-of-child-process/4029.html

crashing processes www.computing.net/answers/unix/crashing-processes/4511.html