Operating System - HP-UX
1832617 Members
2946 Online
110043 Solutions
New Discussion

stopping and restarting jobs' queue

 
SOLVED
Go to solution
Miquel_2
Advisor

stopping and restarting jobs' queue

Hello,

I have a queuedefs file like this:

a.4j1n
b.2j2n90w
d.1j0n1w

I defined the "d" queue for runing only one job at a time and I need to stop this queue for make backup of the oracle database. I stop the queue modifying the line of queuedefs to "d.0j0n1w". I stream jobs that I need to run after the backup finalizes and I need jobs run in order I streamed them, but, when I restart the queue, the jobs run in aleatory order.

Can anybody help me ?

Thanks
19 REPLIES 19
RAC_1
Honored Contributor
Solution

Re: stopping and restarting jobs' queue

Let me get it right. You define d queue. For running backup you stop d queue. After backup is done, you start d queue. Is that right??

Now after above exercise, what runs in wrong order??

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Yes, it's right.

Refering to the wrong order:
When queue is stopped I stream jobs that execute large cobol programs that I need run at night with nobody working. Every cobol program needs to run in order it has been streamed. If I stream first a job that runs the program called A and after this I stream another job that runs program B, and some user streams a job for program C I need they run in order they has been streamd beacause program B needs that program A has finished for make their job and finally can run the user program C.

Sorry for my bad explain of the problem.
Thanks for your interest.

RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

which queue you use to queue those colol jobs?? (d queue??)
what does at -l -q "a|b|c|d" say after you queue the jobs??

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Yes, it's right.

The message I recive after queue jobs is like this:

From dimpsg@itaca.itaca.mgc.es Thu Jun 9 00:01:02 MET 2005
Received: (from dimpsg@localhost)
by itaca.itaca.mgc.es (8.11.1/8.11.1) id j58M12B19139
for dimpsg; Thu, 9 Jun 2005 00:01:02 +0200 (METDST)
Date: Thu, 9 Jun 2005 00:01:02 +0200 (METDST)
From: dimpsg@itaca.itaca.mgc.es
Message-Id: <200506082201.j58M12B19139@itaca.itaca.mgc.es>

warning: commands will be executed using /usr/bin/sh
job 1118268067.d at Thu Jun 9 00:01:02 2005
RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

What does following command say after you queue jobs in "d" queue??

at -l -q d

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Sorry,

This is:

$ at -l -q d
1118353786.d Thu Jun 9 23:49:46 2005
1118353788.d Thu Jun 9 23:49:48 2005
1118353789.d Thu Jun 9 23:49:49 2005
1118353790.d Thu Jun 9 23:49:50 2005
1118353791.d Thu Jun 9 23:49:51 2005
RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

Everything appears as expected.

1118353786.d Thu Jun 9 23:49:46 2005
1118353788.d Thu Jun 9 23:49:48 2005
1118353789.d Thu Jun 9 23:49:49 2005
1118353790.d Thu Jun 9 23:49:50 2005
1118353791.d Thu Jun 9 23:49:51 2005

Do you say that 1118353791.d run before 1118353786.d?? Or something similar??
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Yes, this is exactly what happens. After I restart the queue, 1118353791.d run before 1118353786.d
RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

Miquel,

Do not give points untill problem is resolved. That way, othere running into same problem can look here and get useful information.

Now for each of the jobs in at -l -q d post following.

at -l "job_id"

Anil
There is no substitute to HARDWORK
RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

How long all these jobs run?? For all those scripts, at the start can you do date >> some log??

We will verify what exactly is happening. I am doubting that the time difference is so small that it might appear that they are being executed in wrong order.

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

$ at -l -q d
1118353786.d Thu Jun 9 23:49:46 2005
1118353788.d Thu Jun 9 23:49:48 2005
1118353789.d Thu Jun 9 23:49:49 2005
1118353790.d Thu Jun 9 23:49:50 2005
1118353791.d Thu Jun 9 23:49:51 2005
1118354461.d Fri Jun 10 00:01:01 2005
1118354462.d Fri Jun 10 00:01:02 2005
1118354463.d Fri Jun 10 00:01:03 2005
1118354464.d Fri Jun 10 00:01:04 2005
1118354465.d Fri Jun 10 00:01:05 2005
1118354466.d Fri Jun 10 00:01:06 2005
1118354467.d Fri Jun 10 00:01:07 2005
1118354468.d Fri Jun 10 00:01:08 2005
1118354469.d Fri Jun 10 00:01:09 2005

$ at -l 1118353786.d
1118353786.d Thu Jun 9 23:49:46 2005

$ at -l 1118353788.d
1118353788.d Thu Jun 9 23:49:48 2005

$ at -l 1118353789.d
1118353789.d Thu Jun 9 23:49:49 2005

$ at -l 1118353790.d
1118353790.d Thu Jun 9 23:49:50 2005

$ at -l 1118353791.d
1118353791.d Thu Jun 9 23:49:51 2005

$ at -l 1118354461.d
1118354461.d Fri Jun 10 00:01:01 2005

$ at -l 1118354462.d
1118354462.d Fri Jun 10 00:01:02 2005

$ at -l 1118354463.d
1118354463.d Fri Jun 10 00:01:03 2005

$ at -l 1118354464.d
1118354464.d Fri Jun 10 00:01:04 2005

$ at -l 1118354465.d
1118354465.d Fri Jun 10 00:01:05 2005

$ at -l 1118354466.d
1118354466.d Fri Jun 10 00:01:06 2005

$ at -l 1118354467.d
1118354467.d Fri Jun 10 00:01:07 2005

$ at -l 1118354468.d
1118354468.d Fri Jun 10 00:01:08 2005

$ at -l 1118354469.d
1118354469.d Fri Jun 10 00:01:09 2005

$
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Some jobs runs for one minute, some jobs runs for two hours.
RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

I think at is doing what it is supposed to do. The time difference between jobs is so small that you won't notice anything. At is used to start those jobs at defined times and not to start second one after one starts.

If you want job2 to start after job1 ends, then you need to take care of it. Put a condition in job1 something like follows.

The end of the job1 would look like follows.

jobe1 code
xxx
xxx
status_job1=$?
if [[ status_job1 -eq 0 ]]
then
at -f "job2_script" -t now +1
fi

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

But I don't know "job2_script" beacause it's can be queued by any uset at any time from interactive programs and I can not include it in "job1".

Now I have an idea, if at end of every job I add the execution of a script like this:

$cat personal_rescheduling
jobs_dir="/var/spool/cron/atjobs/"
ls -1 $jobs_dir | while read num_job
do
at -qd now < $jobs_dir$num_job
at -r $num_job
done

I think all will be ok, what do you think about this ?

RAC_1
Honored Contributor

Re: stopping and restarting jobs' queue

That is what I am advising you to do. What you need to do is job1 ends and starts up scond job and second job ends and starts up third.

You not only get the correct order in which they would start, you can also put error code checking to decide to start next job or not, OR to start in different way depending upon error code.

Anil
There is no substitute to HARDWORK
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Sorry, now I think this is not completly correct. If I stop the queue, when I restart it, first job to run can be any of queued jobs. After this first job runs, all other jobs run in correct order, but I don't know what job will be the first.
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Except if in the script that change queue limit from 0 to 1 and viceversa I append at the end same personal_reschedule script.

At this point, I think only one little problem can have, every time I reschedule a queued job, the at command inserts at the begining of the script all of the environment variables. Is this a serious problem or I can discard it ?

Sorry for don't undrestand what you try to tell me in your last message, sorry.
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

What do you think about this ?

Thanks.
Miquel_2
Advisor

Re: stopping and restarting jobs' queue

Thanks.