Multiple Process issue

Hello all,

First of all, I want to thank the forum for being so helpful to me in many occasions. I have searched through the forums and the internet. I couldnt find a perfect solution for my issue. Here is what Im trying to do..

Im verifying a bunch of jobs whether they are completed or not and start the next set. We have two sets of jobs one is LongRunning(LR) and the other SR jobs. The SR jobs are in sets of 7 and the LR are by themselves. We have to start the next set of jobs after completion of the first set.. For ex..

LR1 Job1
LR2 Job2
SR1 Job3
SR1 Job4
SR1 Job5
SR1 Job6
SR1 Job7
SR1 Job8
SR1 Job9
LR3 Job10
LR4 Job11
SR2 Job12
SR2 Job13
SR2 ....

LR1, LR2 and SR1 starts simultaneously. I need to check for LR1 completion to start the LR3 and LR2's completion to start LR4. But on the other hand, I have to wait for all the SR1 jobs to complete to start SR2 jobs. The SR jobs runs much faster than the LR jobs.

What I have done so far is ; Verify the LR jobs and write to 2 different files, completedLR.txt if it is completed and to runningLR.txt if it is still running. Simultaneously, I verify the SRjobs for completion. Its working for the first time. What Im having trouble with is to check the jobs after 3mins. Im having trouble in putting them into a loop where it will keep checking and also continue with starting the next set of jobs at the same time.

My main program calls a subprogram ;

main.sh
--- checkcomp.sh LR &
--- checkcomp.sh SR &
verify the completedLR.txt and go to the next set of jobs.

All the starting and verification of completion are against oracle tables. I have to just update the tables with timestamp for it to start the job and verify the stoptime for completion. Im very much confused to find a way to run one process which will keep checking the completion every 3mins and the other one to proceed further with the next and then the next set of jobs continuously.

Im not that wellversed in Unix. Any kind of help would be much appreciated. Im new to this forum as well. If I havent clarified anything clearly to help further, please let me know.

Thanks much in advance
Jay

The company I work for is using UC4, a job management system. They have tons of different job plans and can manage such stuff easy with it.

Else I suggest to write a simple shell script triggered every minute by cron to verify which job has run (ps -ef or as you do SELECT for some timestamps) and then run the next. Make that shell script reading a plain textfile, where you have your order of the scripts etc. in it and have the script processing it on the logic/order you want.
If you need to "remind" stati of different jobs beside the ps or SELECT on timestamps, you can easy use "lock" files by just touching them with the information you will need.
It will be a bunch of if/then/fi, while/do/done, case/esac and such to implement the logic you want.