Conditional execution and parallel jobs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Conditional execution and parallel jobs
# 1  
Old 05-02-2009
Conditional execution and parallel jobs

how can i process jobs parallel with conditions below.

Script1.ksh
Script2.ksh
Script3.ksh
Script4.ksh
Script5.ksh
Script6.ksh
Script7.ksh
Script8.ksh
Script9.ksh
Script10.ksh


After successful completion of Script1.ksh I need to run Script7.ksh.
After successful completion of Script7.ksh I need to run Script8,9,10...
Script2,3,4,5,6 should run parallel and has no conditions..
# 2  
Old 05-02-2009
you can use wait PID( for the last background job) to wait for its successful completion of the last background job and then run the next job.

cheers,
Devaraj Takhellambam
# 3  
Old 05-02-2009
Thanks for your reply.
If jobs run through cron how do we handle this Situation?
# 4  
Old 05-03-2009
Quote:
Originally Posted by ford2020
Thanks for your reply.
If jobs run through cron how do we handle this Situation?
You may need to program to capture the PID of the last run script
something like

Code:
pid=`ps -ef  | grep "lastscriptname"| awk '{print $2}'`


cheers,
Devaraj Takhellambam
# 5  
Old 05-03-2009
man wait
Code:
/../Script1.ksh
wait $?
...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Conditional execution

Here's an interesting (to me, anyway) little puzzle. Background: I have a process that restores a number of large(ish) files from tape backup. As an individual file is being written, it is owned by root, then the ownership is changed when that file is complete. Since this process can take... (3 Replies)
Discussion started by: edstevens
3 Replies

2. Shell Programming and Scripting

Conditional Execution of a Script.

I have a unix shell script Test.sh more Test.sh echo "Calling dbquery1.sh...." ./dbquery1.sh echo "Calling dbquery2.sh...." ./dbquery2.sh more dbquery1.sh sqlplus -s user1/password1@DB_SID @/tmp/storedprocedures/Hello.rcp I run Test.sh However, I do not want dbquery2.sh to be... (3 Replies)
Discussion started by: mohtashims
3 Replies

3. Shell Programming and Scripting

search and conditional execution

Hi, I have a list of files with different filenames like nam0001.txt,pan0001.txt etc coming in /data/inbox from various places. I needed a shell script which would:- 1)searches for a word from the filenames (coming in inbox directory) provided in input parameter. 2)if found, put in... (2 Replies)
Discussion started by: Saiesh
2 Replies

4. UNIX for Dummies Questions & Answers

Conditional execution of statements

Hi , I have a script which has multiple awk and sed commands like below. First one :- find /root/src/ -name "*csv" -size 0 -exec rm {} \; Second one: - ls *SRE*.txt > SRT_TRAN.dat rm *asr*.txt Third one :- find /root/src/ -name '*.csv' | while read FILENAME ; do awk... (2 Replies)
Discussion started by: shruthidwh
2 Replies

5. Shell Programming and Scripting

waiting on jobs in bash, allowing limited parallel jobs at one time, and then for all to finish

Hello, I am running GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu). I have a specific question pertaining to waiting on jobs run in sub-shells, based on the max number of parallel processes I want to allow, and then wait... (1 Reply)
Discussion started by: srao
1 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

jobs run parallel - server consumption?

I have a requirement where jobs/scripts need to be run in the background.The concern here is there are around 20 scripts which need to be run in the bg.Does running all the 20 scripts/job at the same time in bg consumes much sever-utilization. If so wot would be the efficient way to run the jobs... (5 Replies)
Discussion started by: michaelrozar17
5 Replies

8. Shell Programming and Scripting

Conditional execution

Hi All, I want to echo a message in case a system is reachable by ping or echo a different message in case it's not reachable. Sample code i wrote is ping localhost -n 2 | grep 'ttl' > ping_op; ls ping_op > /dev/null && drReachable=Alive; echo -e `date`: \\t "DR server is reachable" >>... (5 Replies)
Discussion started by: Mr. Zer0
5 Replies

9. Shell Programming and Scripting

Diff: Server n parallel jobs

Hi, Could any one please explain the difference between DataStage server edition jobs and DS parallel extender jobs...? In which scenarios or application areas do we use either of these jobs.? Regards Suresh (0 Replies)
Discussion started by: sureshg_sampat
0 Replies

10. Shell Programming and Scripting

Parallel Execution

Hello, I wish to run parallel process forked from one script. Currently I doing is submit them in background. For example: --------------------------------------------------------------- #!/usr/bin/ksh process1 & process2 & process3 & ..... ..... #here I check for completion of... (4 Replies)
Discussion started by: RishiPahuja
4 Replies
Login or Register to Ask a Question