Running script in Parallel


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running script in Parallel
# 1  
Old 03-12-2013
Running script in Parallel

Hi Folks
I have a doubt. I have a script which is running with 2 input parameters

Code:
./GetDSLnkCount.sh <jobnumber> Parmfile.txt

I need to run the script in parallel for different jobnumbers. The commands are

Code:
./GetDSLnkCount.sh jnhuc14500 Parmfile.txt 
./GetDSLnkCount.sh jnhuc14501 Parmfile.txt 
./GetDSLnkCount.sh jnhuc14502 Parmfile.txt 
./GetDSLnkCount.sh jnhuc14503 Parmfile.txt 
./GetDSLnkCount.sh jnhuc14504 Parmfile.txt

So What I have done is I copied all the above commands to File and doing like this


Code:
cat File|
{
while read LINE
do
$LINE $
done
}

So do you think this will run all the command in parallel or this will be in a sequence mode ?

Last edited by Scott; 03-12-2013 at 12:38 AM.. Reason: Code tags, please...
# 2  
Old 03-12-2013
I guess you mean $LINE &, not $LINE $?

Change it to:
Code:
while read LINE
do
  $LINE &
done < File
wait

And see!

You will need the "wait", unless you run "$LINE" nohup, otherwise all of your commands running with "&" will die unceremoniously when your script finishes.
# 3  
Old 03-12-2013
I m sorry ,I mean $LINE &

Let me try it out . Thanks man


---------- Post updated at 11:42 PM ---------- Previous update was at 10:48 PM ----------

I have tried this command .But it hangs
# 4  
Old 03-12-2013
It would if it was waiting.

How long would you typically expect one of these "GetDSLnkCount.sh" jobs to run?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running 3 shell script parallel in another shell script

Hi, I'm trying to do teh below thing. I have a single script which uses 3 different parameters to do 3 different work like belwo. test1.sh par1 -- it shuts down an instance test1.sh par2 -- it shuts down an instance test1.sh par3 -- it shuts down an instance Now I created a script... (7 Replies)
Discussion started by: bhaski2012
7 Replies

2. Shell Programming and Scripting

Script running in parallel failing!

Hi, I have a single script that was running fine in parallel on Linux 2.6.9-89 now it has been upgraded to Linux 2.6.18-308.24.1.el5 and the script has started to fail unpredictably. Is this an upgrade issue? As the script runs fine for some parallel threads while fails for others. Please... (4 Replies)
Discussion started by: Panna
4 Replies

3. Shell Programming and Scripting

[Solved] Running scripts in parallel

i have script A and script B, both scripts have to run in parallel, my requirement is script A create table temp1, post creating it will run fr 4 hrs , script B has to start 0nly after creation of table temp1 ( which is done by script A) , again script B will run for 5 hrs if i run sequencially... (7 Replies)
Discussion started by: only4satish
7 Replies

4. UNIX for Dummies Questions & Answers

Running parallel process

i am having 4 process,have to run parallel and not after one by one. sample1.sh sample2.sh sample3.sh sample4.sh Thanks in advance. i (11 Replies)
Discussion started by: sagar_1986
11 Replies

5. Shell Programming and Scripting

Running uniq -c and sort -nr in parallel.

Hi All, I have a huge collection of files in a directory about 200000. I have the command below but it only uses one core of the computer. I want it to do task in parallel. This is the command that I want to run in parallel: sort testfile | uniq -c | sort -nr I know how to run sort... (10 Replies)
Discussion started by: shoaibjameel123
10 Replies

6. Shell Programming and Scripting

Running jobs in parallel

I need to process 50 sqlplus scripts which are listed in a text file. I need to develop a shell script that'll read this file and run these sqlplus scripts. At any point of time, the number of sqlplus scripts running shouldn't exceed 6. If any of the sqlplus scripts completes successfully then... (17 Replies)
Discussion started by: gctex
17 Replies

7. Shell Programming and Scripting

Running shell script in parallel

Hi, I am a shell script which takes input parameters and performs various functions. My concern is, if we call the same shell script with different parameter values from different sessions, will the results be inconsistent? Are there any precautions I need to take inorder to avoid conflicts... (1 Reply)
Discussion started by: jamjam10k
1 Replies

8. IP Networking

running servers parallel

I'm going to undertake a hardware refresh soon and I was wondering if it is possible to run two machines (X and Y) with the same hostname (but different IP addresses) on the same network? Server X is the original server and has an entry in DNS. Server Y is the new server and won't have an entry... (1 Reply)
Discussion started by: soliberus
1 Replies

9. Shell Programming and Scripting

Running scripts in parallel

Hi, Iam having the scripts as follows. i jus want to run those in parallel. main aim is to minimise the time for overall execution of the script. now out.txt is having 1 lac records. script1(split.sh) split -1000 out.txt splitout ls -A splitout* > filelist.txt cat filelist.txt... (6 Replies)
Discussion started by: nivas
6 Replies

10. Programming

running a parallel program

hi , i need to run a parallel program . for example; program1 { array=" the second program should called here : program 2" the execution should continue } the 2nd program should recieve an array of information as argument and it should... (4 Replies)
Discussion started by: bankpro
4 Replies
Login or Register to Ask a Question