Background information about a job
Moderators: chulett, rschirm, roy
Background information about a job
Hi,
If we run a job and click Job-->Cleanup resources, we will get the pid for that particular job.
if its a parallel job, i have seen some jbname.fifo process.
Issuing LIST.READU is similar to Job-->Cleanup resources?
I dont think so. If not whats the equivalent command for that in DS Administrator,
The real reason for why i am asking is , i want to write a BASIC routine for stopping a job(server or px).
We can simply stop it in director.
SOmetimes, the jobs are not getting stopped.
My requirement is i will pass the jobname to the routine.
It should stop that job.
Please help me.
Thanks
If we run a job and click Job-->Cleanup resources, we will get the pid for that particular job.
if its a parallel job, i have seen some jbname.fifo process.
Issuing LIST.READU is similar to Job-->Cleanup resources?
I dont think so. If not whats the equivalent command for that in DS Administrator,
The real reason for why i am asking is , i want to write a BASIC routine for stopping a job(server or px).
We can simply stop it in director.
SOmetimes, the jobs are not getting stopped.
My requirement is i will pass the jobname to the routine.
It should stop that job.
Please help me.
Thanks
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
LIST.READU is exactly the command that fills the locks area of Cleanup Resources.
Last edited by ray.wurlod on Mon Apr 16, 2012 2:46 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
When a server/px job is running, if we issue LIST.READU , will there be any entry in the name of that particular running job?
But i guess, the entry will not be exactly in the same name as the job, but something like DSD.*.
Please correct me if i am wrong.
Because i want to find the way to stop a job using routine.
Thanks
But i guess, the entry will not be exactly in the same name as the job, but something like DSD.*.
Please correct me if i am wrong.
Because i want to find the way to stop a job using routine.
Thanks
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
DSAttachJob()
DSGetJobInfo() ;* check status is DSJS.RUNNING
DSStopJob() ;* issue stop request
DSDetachJob()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Thanks Ray!!
It works for all the jobs which are stoppable in director.
But there are some jobs which i am not able to stop in director.
Even i have tried with this routine.
Even though the routine returns 0 code, the jobs are not being stopped.
My code is:
It works for all the jobs which are stoppable in director.
But there are some jobs which i am not able to stop in director.
Even i have tried with this routine.
Even though the routine returns 0 code, the jobs are not being stopped.
My code is:
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
***CallingProgName = DSJ.ME
Jobname = Arg1
JobHandle = DSAttachJob(Jobname, DSJ.ERRNONE)
STATUS = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
Call DSLogInfo("the status is" : STATUS,"")
if STATUS = "0"
then
PRINT "The job is currently running"
stoperr = DSStopJob(JobHandle)
if stoperr = 0
then
PRINT "the job stopped successfully"
END
else
PRINT "Invalid Job handle"
Ans=2
END
END
ELSE
PRINT "The job is not running currently"
Ans=1
END
Call DSDetachJob(Jobname,DSJ.ERRNONE)
Ans=0
pandeeswaran
For those jobs, which i am not able to stop i have noticed that there's a process called RT_CONFIGXXXX WHERE XXXX is a job number.
So, what i have planned is getting the job number for that particular process and apend that to RT_CONFIG.
Then using FINDSTR find the INODE number and then clear that.
But i am not able to get the job number:
the code i have tried is:;
But in DS Administrator client, we used to click respond option.
In script How we can do that?
i am getting the output as:
Please help me to extract the jobno alone.
thanks
So, what i have planned is getting the job number for that particular process and apend that to RT_CONFIG.
Then using FINDSTR find the INODE number and then clear that.
But i am not able to get the job number:
the code i have tried is:;
Code: Select all
Command = "SELECT JOBNO FROM DS_JOBS WHERE NAME=':Arg1:'"
Call DSExecute("TCL",Command,Output,Result)
Call DSLogInfo("The output is" :Output,"")
Ans=0
In script How we can do that?
i am getting the output as:
Code: Select all
+DSLogInfo called from :
Message to be logged is...
> The output isSQL
thanks
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,
I am executing the below code:
Am i missing any quotes over there?
Evn if i pass valid job name to Arg1 , the routine says 0 records listed.
Please help me.
thanks
I am executing the below code:
Code: Select all
Command = "SELECT JOBNO FROM DS_JOBS WHERE NAME=':Arg1';"
Evn if i pass valid job name to Arg1 , the routine says 0 records listed.
Please help me.
thanks
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Thanks ray!
Finally, the below is the routine which stops the jobs which can't be stopped via director.
Thanks
Finally, the below is the routine which stops the jobs which can't be stopped via director.
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
***CallingProgName = DSJ.ME
Jobname = Arg1
JobHandle = DSAttachJob(Jobname, DSJ.ERRNONE)
STATUS = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
Call DSLogInfo("the status is" : STATUS,"")
if STATUS = "0"
then
PRINT "The job is currently running"
stoperr = DSStopJob(JobHandle)
if stoperr = 0
then
STATUS = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
if STATUS <> 0
then
PRINT "the job stopped successfully"
Ans=0
END
else
command = 'ps -ef | grep ':Jobname:' | grep -v grep | cut -d " " -f4 | head -1'
Call DSExecute('UNIX',command,output1,Result)
Call DSLogInfo("the pid is" :output1,"")
if output1 = ""
then
PRINT "No processes for the mentioned job"
PRINT "Stop unsuccessful"
Ans = 3
END
ELSE
out = Convert(@FM,"",output1)
cmd = 'kill -9 ':out:''
Call DSExecute('UNIX',cmd,output2,RC)
Call DSLogInfo("the output2 is" :output2,"")
Call DSLogInfo("the RC is" :RC,"")
if RC = 0
then
PRINT "Kill successful"
PRINT "Job successfully stopped"
Ans=0
END
ELSE
PRINT "Unable to stop"
Ans=1
END
END
END
END
ELSE
PRINT "Job failed to stop"
END
END
ELSE
PRINT "The job is not running currently"
Ans=1
END
Call DSDetachJob(Jobname,DSJ.ERRNONE)
Ans=0
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DSDetachJob() takes a single argument (not two) and that needs to be a job handle, not a job name.
If you must use kill, make it more gentle, maybe -15 so that the job gets some grace time to close files, release locks, etc. SIGKILL (-9) can leave locks.
Your other problem, for parallel jobs, is that of cleaning up all the processes in the job. These must be stopped in the correct order; player processes, then section leaders and finally the conductor process. Your code pays no attention to that.
If you must use kill, make it more gentle, maybe -15 so that the job gets some grace time to close files, release locks, etc. SIGKILL (-9) can leave locks.
Your other problem, for parallel jobs, is that of cleaning up all the processes in the job. These must be stopped in the correct order; player processes, then section leaders and finally the conductor process. Your code pays no attention to that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.