The below code is still returning zero when you have 6 processes running
You can see that the number of jobs goes to [6] in the output, you then get the error about cnt=0 and then in jumps to [12].
My code was doing the correct thing to start with. It started 6 jobs and was was waiting for one of them to finish. You did ps -ef | grep "sqlplus -s" and didn't see anything so you assumed no jobs were started. The issue was that the processes aren't being picked up by the grep search.
As I suggested before start a job and then do ps -fp <pid> to find out what the command line is, this will help debug why grep "sqlplus -s" is not matching it.
The test on numeric value should have || this is "or" in shell not "pipe".
For me "ps -ef|grep "sqlplus -s"|grep -v grep|wc -l" is showing the number of sessions running correctly. It shows 6 processes or less when the script is running. Not sure why you are getting 0.
Your code with "jobs" and "wait" just didn't go beyond the first 6 sqls for me. This whole job involving 50 tables takes only 2 minutes but when running your code it processed only 6 sqls and just didn't move further even after 5 minutes. I had to kill (ctrl+C) it everytime. I just tried it again and it gives the same results, only 6 sqls are processed and 6 logfiles are generated.
If you feel like debugging it just run jobs with output to the terminal before the sleep:
It works fine if I run the sleep command as my background task, but I'm curious about what in your environment is causing jobs to still keep reporting stuff thats finished.
This User Gave Thanks to Chubler_XL For This Post:
Yeah Chubler, something in our envirorment does behave weird. If I replace "ps -ef" with "jobs" it just doesn't go beyond the first 6 sqls. Anyways, "ps -ef" works fine for me, occasional bad number error is there, when the "ps -ef" count is 0.
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)
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)
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)
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... (4 Replies)
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)
Hi,
Iam having the scripts as follows. i jus want to run those in parallel.
main aim is to minimise the time for overall execution of the script.
now out.txt is having 1 lac records.
script1(split.sh)
split -1000 out.txt splitout
ls -A splitout* > filelist.txt
cat filelist.txt... (6 Replies)
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)
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)