Run multiple procedures from shell script parallely


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run multiple procedures from shell script parallely
# 8  
Old 02-26-2015
Quote:
Originally Posted by Neelkanth
To verify locking part, I ran the procedures in three seperate unix sessions. They ran perfectly. So it cant be locking.
You also mentioned frozen for interaction with user.
I also added nohup to the procedure call commands, still result is same.
This wouldn't stop it from opening /dev/tty.

Please show the code you tried which didn't work. Maybe there's a mistake we can fix. There's no reason except the code or the terminal that it'd get frozen, 'command &' does exactly what you want - put it in background.
This User Gave Thanks to Corona688 For This Post:
# 9  
Old 02-27-2015
Below is the code i used in my script:
Code:
   #! /bin/sh
clear
db2 connect to rptprdd1 user ss154253 using ss154253


nohup db2 "CALL PTL.GET_CASE_DETAIL(?,?,?)" &
pid1=$!
nohup db2 "CALL PTL.GET_CONSOLIDATED_DEMAND(?,?,?)" &
pid2=$!
nohup db2 "CALL PTL.GET_STATEMENT_DETAIL(?,?,?)" &
pid3=$!
nohup db2 "CALL PTL.GET_SURVEY_DETAIL(?,?,?)" &
pid4=$!
nohup db2 "CALL PTL.GET_TAN_COUNT(?,?,?)" &
pid5=$!
nohup db2 "CALL PTL.GET_TOTAL_COLLECTION(?,?,?)" &
pid6=$!


wait $pid1 $pid2 $pid3 $pid4 $pid5 $pid6


db2 connect reset



Its only running first procedure.
But when i run these 6 procs from six different unix sessions, all run simultaneously.
# 10  
Old 02-27-2015
Do you have the setsid utility?
# 11  
Old 02-27-2015
Hi,

I am not aware of this utility. I can only confirm after going back to office.

How can I check if I have it? Will it come up in man command.

Also how can i use it in my script.
# 12  
Old 02-27-2015
whereis setsid or which setsid etc etc.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to run multiple jobs and it's dependent jobs

I have multiple jobs and each job dependent on other job. Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE. I need an help how to start. Attaching the JOB dependency... (3 Replies)
Discussion started by: santoshkumarkal
3 Replies

2. Shell Programming and Scripting

How to run scripts parallely inside shell script?

Hi , I have 4 scripts example script1,script2,script3,script4 . I have to run script1,script2 and script3 parallely since this 3 scripts dont have dependencies . Once script1,script2 and script3 got completed successfully , I have to trigger script4. Can someone help me on this how to... (10 Replies)
Discussion started by: vinothsekark
10 Replies

3. Shell Programming and Scripting

Run different SQL on multiple DBs using SHELL script

Hi Experts, I have a list of Dbs.In that DBs i need to execute some sql scripts. each sql script is unique and it should run on particular DB only. For example. i have DBs like MDC20V,NDC20V,ODC20V and sql scripts like MD.sql,ND.sql,OD.sql.so MD.sql should run only in MDC20V and ND.sql should... (1 Reply)
Discussion started by: navsan420
1 Replies

4. UNIX for Advanced & Expert Users

How to process multiple files parallely

Hi, I have a requirement to process multiple files in a directory parallely.Consider the below scenario: In a directory there are three files file1,file2 and file3.When I use for loop each file will be executed in sequence but I want to process parallely. Any Help would be appreciated.... (1 Reply)
Discussion started by: liyakathali
1 Replies

5. Shell Programming and Scripting

How to run multiple instances of shell script in linux?

How we can run the multiple instances of the script? I need to run the script which I am calling from the below function.I can doit with cron but I don't want to put it in the cron.This cript dploy the build and here I want when the build stage then it should run with multilpe instances of... (6 Replies)
Discussion started by: anuragpgtgerman
6 Replies

6. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

7. UNIX and Linux Applications

how to run more than two processes parallely

I would like to call a function called CIRCLE which is further beind called by other function but in a loop that CIRCLE fuction is being called. And this CIRCLE function starts another process which takes 3 hours to complete again, if i put that process in nohup &, I can go to the next command... (2 Replies)
Discussion started by: venugopalsmartb
2 Replies

8. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

9. Shell Programming and Scripting

Multiple Threads/Tasks to run parallely using the shell script

Scenario: I have two PCs (named as A & B) which would send some traps to my third PC (named as C). In PC C, I have to write a shell script such that it should accept the datas from both the PC-A & B parallely. So my question is, is it possible to have two different child threads/tasks... (2 Replies)
Discussion started by: nthiruvenkatam
2 Replies

10. Shell Programming and Scripting

Run a script parallely with different arguments

Hi! I want to run a script in parallel with different arguments. eg. start script.sh argA script.sh argB script.sh argC end Can someone please tell how to achieve this. Thanks in advance. (4 Replies)
Discussion started by: dummyix
4 Replies
Login or Register to Ask a Question