Running shell script in parallel


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running shell script in parallel
# 1  
Old 02-08-2010
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 between several instances of the same script?
Is there any limitation on the number of parallel instances you can create for a shell script?
BTW, I am using bash.

Thanks
# 2  
Old 02-08-2010
The one practice in I can think of is that any temporary files you store in /tmp or /var/tmp should use $$ (the current processes PID) as part of the filename to avoid clashing file usage. Doing this means it is important to remember to delete the temporary files when you have finished using them or else /tmp will get clogged up!

Any outputted results file should either use $$ or the date and time in the filename to avoid them clashing or else make sure you append to the output file (>> outputfile) not replace (> outputfile) which would overwrite the previously run script's results.

Multiple runs of a script with different parameters should not be a problem otherwise.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parallel for in a Script Shell

Hello, This is my Script which configure a list of nodes. ( 40 nodes, and the configuration 10 minutes) #! /bin/sh if then echo "USE: ./start.sh nodes else nb_lignes=`wc -l $1 | cut -d " " -f1` echo "$nb_lignes machines" for i in $(seq $nb_lignes) //instructions done fi My... (2 Replies)
Discussion started by: chercheur111
2 Replies

2. 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

3. Shell Programming and Scripting

Running script in Parallel

Hi Folks I have a doubt. I have a script which is running with 2 input parameters ./GetDSLnkCount.sh <jobnumber> Parmfile.txt I need to run the script in parallel for different jobnumbers. The commands are ./GetDSLnkCount.sh jnhuc14500 Parmfile.txt ./GetDSLnkCount.sh jnhuc14501... (3 Replies)
Discussion started by: morbid_angel
3 Replies

4. 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

5. Shell Programming and Scripting

Parallel SQL sessions in shell script

i have 3 sqls , sql 1 and sql 2 shuld run in parallel , but sql 3 should run after completion f sql1 nd sql2, my code is as below, please suggest the changes sqlplus username1/password1@DB1 @sql >> log1 & sqlplus username2/password2@DB2 @sql2 >> log1 & how can i execute the... (7 Replies)
Discussion started by: only4satish
7 Replies

6. 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

7. 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

8. Shell Programming and Scripting

Help with executing parallel sessions for same shell script with different but fixed parameters

Hi Experts, There is a shell script that accepts positional parameter between 1-25 to execute case statement of script depending upon the parameter passed. Now I need to run all the 25 sessions parallely. In each option of case statement it is connecting with sqlplus and executing a select... (11 Replies)
Discussion started by: Opamps123
11 Replies

9. 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

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