The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Parallel Job Execution Prashantckc Shell Programming and Scripting 4 05-02-2009 03:16 PM
Parallel Execution on Multiple System 123an High Performance Computing 7 03-16-2009 03:59 AM
Parallel SSH execution and a single shell to control them all iBot UNIX and Linux RSS News 0 10-30-2008 04:50 AM
Make : parallel execution suman_jakkula AIX 0 03-14-2006 03:33 AM
Parallel Execution RishiPahuja Shell Programming and Scripting 4 05-10-2005 03:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-10-2009
anand_msm anand_msm is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 4
Job Execution in Parallel and Maintain Dependency

All,

We need to run multiple jobs in parallel with the dependencies intact.

I was trying to use the same with &, but in vain. Is there is any other way to resolve this issue.



I need to run
Set1
A.sh
B.sh
C.sh


Set2
D.sh
E.sh


Set3
F.sh
G.sh


Jobs Parallely

When Set1 Completes I need to run the below Set4 irrespective of other sets

Set4
AA.sh
BB.sh


When set2 completes I need to run below Set 5 irrespective of other sets

Set 5
CC.sh


When set3 completed I need to run below Set 6 irrespective of other sets

Set6
DD.sh


Once Set 4, 5, 6 completes I need to run set7

Set7
final.sh


How can I make this parallel and set the dependency also?

any help is appreciated.

Regards
Anand M
  #2 (permalink)  
Old 02-10-2009
anand_msm anand_msm is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 4
Can anyone help me in this regard?

Any help would be great.

Thanks
Anand
  #3 (permalink)  
Old 02-10-2009
scorpio scorpio is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 41
Hi ,

bundle the sets(A,B....) to one one scripts and try...
For parallel running normally using "&" ..

for dependency wait command u can use..
Hope this will help


Regards,
  #4 (permalink)  
Old 02-10-2009
scorpio scorpio is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 41
Hi,

Try something like this...( i have not tested this code)

#!/bin/sh

./Set1.sh &
process_id_set1=`ps -ef | grep ora_q001_DM2XDB | grep -v grep | awk '{print $2}'`
./Set2.sh &
process_id_set2=`ps -ef | grep ora_q001_DM2XDB | grep -v grep | awk '{print $2}'`
./Set3.sh &
process_id_set3=`ps -ef | grep ora_q001_DM2XDB | grep -v grep | awk '{print $2}'`

wait process_id_set1
echo "Set1 Completed -- now start Set4"
./Set4.sh &

wait process_id_set2
echo "Set2 Completed -- now start Set5"
./Set5.sh &




Regards,
  #5 (permalink)  
Old 02-10-2009
scorpio scorpio is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 41
sorry replace ora_q001_DM2XDB with ur script name
  #6 (permalink)  
Old 02-11-2009
anand_msm anand_msm is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 4
Thanks for the reply. I will try the same.

Rgds
Anand
  #7 (permalink)  
Old 02-17-2009
rmoncello's Avatar
rmoncello rmoncello is offline
Registered User
  
 

Join Date: Feb 2009
Location: Frisco, TX
Posts: 22
#!/bin/ksh

#Set1
(A.sh;B.sh;C.sh)&
set1=$!

#Set2
(D.sh;E.sh) &
set2=$!

#Set3
(F.sh;G.sh)&
set3=$!

#When set1 completes I need to run below Set 4 irrespective of other sets

Set4
(wait $set1;AA.sh;BB.sh)&
set4=$!

#When set2 completes I need to run below Set 5 irrespective of other sets

#Set 5
(wait $set2;CC.sh)&
set5=$!

#When set3 completed I need to run below Set 6 irrespective of other sets

#Set6
(wait $set3;DD.sh)&
set6=$!

#Once Set 4, 5, 6 completes I need to run set7

#Set7
wait $set4
wait $set5
wait $set6
final.sh

#################################

The first line "#!/bin/ksh" forces the script to be run in ksh.
The $! is a ksh builtin returning the last PID run in background

Last edited by rmoncello; 02-18-2009 at 02:09 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0