Need to execute 2 scripts, wait, execute 2 more wait, till end of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to execute 2 scripts, wait, execute 2 more wait, till end of file
# 1  
Old 08-01-2006
Question Need to execute 2 scripts, wait, execute 2 more wait, till end of file

Smilie

I need to execute a shell script to do the following:

cat a file
run two back ground processes using the first two values from the file
wait till those background processes finish
run two more background processes using the next two values from the file
wait till those background processes finish
etc till the end of the file.


Can anyone give me a way to do this? I cannot run all of the background processes at the same time, I can only do two at time.
# 2  
Old 08-01-2006
You said it yourself...

runtask arg &
runtask arg &
wait
...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Wait till any one child process finishes

Hi I am facing a problem in my ksh. My main script is calling 3 different child process in the background. I am using wait to finish all and then submit another 3 child processes. Now what i want is , whenever any one child process finishes ,i want to submit next one.so that parallel 3... (2 Replies)
Discussion started by: Sangu
2 Replies

2. AIX

Need ./ to execute scripts

Hi, I am really sorry for this question but still i am confused. I have shell script called sample.sh I can execute only with the combination of ./sample.sh Is ./ really necessary ? Is it something related with $HOME or $PATH variable. Why and How can i resolve this case ? ... (2 Replies)
Discussion started by: Nandy
2 Replies

3. Programming

How to wait the slave to be finished first then execute the master--MPI C++?

Hi, How to wait the slave to be finished first then execute the master? Can someone give me the specific function? Or the detailed example. Thanks~ (1 Reply)
Discussion started by: wanliushao
1 Replies

4. Shell Programming and Scripting

Look for a file,if not found wait and look again

Hi All, i have a requirement I created a file list as below : more abc_file_list.txt Rem_DD.csv Rem_Non.csv Rem_Ld.csv CC_Ld_Non_IRA.csv ... Above are the 4 files (For now ,we dont know how many in the file) which need to be present else need to get an email for missing files. ... (3 Replies)
Discussion started by: dssyadav
3 Replies

5. Shell Programming and Scripting

Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done'

first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good. I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

6. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

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

9. Shell Programming and Scripting

wait in shell scripts

Hi I am creating 3 background processes in my shell script using &. I have obtained the 3 PIDs of the background processes using $!. I need to wait for these to complete and i need the exit status of each of these. If i use : wait $PID1 wait $PID2 wait $PID3 and get the exit status of... (1 Reply)
Discussion started by: Vinaya
1 Replies

10. UNIX for Dummies Questions & Answers

How can I execute TCL scripts in HP-UX

Hi All, Since I want to execute TCL scripts in HP-UX, I cannot find where to start. I try to execute the following scripts. It gets "tclsh: not found." errors. Where / how to execute tcl scripts? Thanks a lots. #!/bin/sh # the next line restarts using wish \ exec tclsh "$0" "$@" (3 Replies)
Discussion started by: wilsonchan1000
3 Replies
Login or Register to Ask a Question