how to make a parent wait on a child shells running in background?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users how to make a parent wait on a child shells running in background?
# 1  
Old 08-01-2008
how to make a parent wait on a child shells running in background?

Hi

I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running.

My Code:

nohup a.sh > /dev/null 2>&1


Code in a.sh:

nohup b.sh > /opt/portal/6.5/apps/b.txt &
nohup c.sh > /opt/portal/6.5/apps/c.txt &
nohup d.sh > /opt/portal/6.5/apps/d.txt &
nohup e.sh > /opt/portal/6.5/apps/e.txt &
nohup f.sh > /opt/portal/6.5/apps/f.txt &
nohup g.sh > /opt/portal/6.5/apps/g.txt &


i try to grep:
ps -ef|grep a.sh|grep -v grep

I must be able to do this successfully...

Kindly help..

Regards,
Albert
# 2  
Old 08-01-2008
no crossposts! read the rules of unix.com. thread closed...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How make parent to wait from child process?

Hi all, I am starting mgen5 for sometime depends on input from a file, in a child process. now I want to make parent to wait in this child process till mgen5 finishes, or timeout happens. could anyone please tell me how to make parent to wait in child process in shell script? thanks... (2 Replies)
Discussion started by: girijajoshi
2 Replies

2. Shell Programming and Scripting

How to exit from the parent script while the child is running?

hi, i want to call a child shell script from a parent shell script. the child will be running for 5 mins. normally when the child is running, parent will wait till the child completes. so in the above case parent will be paused for 5 mins. is there a way so that the parents does not wait for the... (3 Replies)
Discussion started by: Little
3 Replies

3. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

4. Programming

Parent,child wait,signal

Hello. I want to make a child do some stuff,wait,then the parent does some stuff and then child does some stuff and waits again.I have made the following but it does not work.Can anybody help me? pid1 = fork(); if (pid1 == -1) { perror("Can't create child\n"); ... (18 Replies)
Discussion started by: Cuervo
18 Replies

5. Programming

Pass parameter from a child make to a parent

Hello, I have the following problem: I have makefileproj and makefilemod in a build process for a complex project - from makefileproj I call the makefilemod. In makefilemod I generate a list containing objects eg,: "../../../25_Build/Results/Objects/FBL/Fls.o... (4 Replies)
Discussion started by: marina_lmv
4 Replies

6. Shell Programming and Scripting

Make cron wait for the child process

I am trying to find a list of files and writing it to a text file. Based on the machine performance the file writing will be slow at certain time. The code to find file and redirecting the output to text file is on a shell script /usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a... (4 Replies)
Discussion started by: nuthalapati
4 Replies

7. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

8. Programming

How can I make the parent thread wait

Hi All, I will be glad if you could help me resolve this problem. I have created two detachable threads and wanted to them execute independent of the parent thread ( the main task which creates the detachable threads). But I see no output coming from the execution of two detachable threads.... (4 Replies)
Discussion started by: jayfriend
4 Replies

9. Shell Programming and Scripting

How to export a variable from a child process running in background to the parent

Hi All, I have a script which calls a child script with a parameter to be run in the background . childscript.ksh $a & Can any one suggest me how do i export a variable from the child script to parent script? Note that the child script is in background If the child script is in... (3 Replies)
Discussion started by: aixjadoo
3 Replies

10. Shell Programming and Scripting

multiple child scripts running in backgroud, how to use grep on the parent?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (5 Replies)
Discussion started by: albertashish
5 Replies
Login or Register to Ask a Question