Page 1 of 1
To check status of the job using Shell Script
Posted: Wed May 28, 2008 8:38 am
by girish.rupkumar
Hi All,
I want to check the status of the job (whether it is executed or not) through a UNIX shell script. Is there any way in DS where I can fetch only the status of the job?
Thank you.
Posted: Wed May 28, 2008 9:02 am
by AmeyJoshi14
Yes! :D
You can use following 'dsjob' command to achieve the same:
Code: Select all
. $DSHOME/dsenv
$DSHOME/bin/dsjob -report $project_name $jobname BASIC
In that you can check your job status, it in 'Job status'.
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Wed May 28, 2008 9:14 am
by AmeyJoshi14
I have develop a simple script where in you will get Start Time,End Time,Time consumed,Rundate and Status.You can modify the script as per your requirement.Below is script.
It will take 2 parameters
1.Project Name
2. Job Name
Code: Select all
#!/bin/ksh
. $DSHOME/dsenv
TempDir=Path of Directory
proj=$1
jobname=$2
. $DSHOME/dsenv
$DSHOME/bin/dsjob -report $proj $jobname BASIC 2>/dev/null > $TempDir/tmp.txt
StartTime=`more $TempDir/tmp.txt| fgrep "Job start time" |cut -f2 -d'='` #Getting Start time
EndTime=`more $TempDir/tmp.txt| fgrep "Job end time" |cut -f2 -d'='` #Getting End time
TimeConsumed=`more $TempDir/tmp.txt| fgrep "Job elapsed time" |cut -f2 -d'='` #Getting Time Consumed
Status=`more $TempDir/tmp.txt| fgrep "Job status" |cut -f2 -d'='|cut -f2 -d'('|cut -f1 -d')'` #Status of job
rundate=`more $TempDir/tmp.txt| fgrep "Generated"|cut -f2 -d':'|cut -f2 -d' '`
echo "Job Detials are :"
echo "StartTime=$StartTime"
echo "EndTime=$EndTime"
echo "TimeConsumed=$TimeConsumed"
echo "Status=$Status"
echo "rundate=$rundate"
Hope this will help you !
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Wed May 28, 2008 10:20 pm
by girish.rupkumar
Thanks a lot Joshi...
Regards,
Girish.
Posted: Thu May 29, 2008 12:25 am
by ag_ram
First, we may recommend you to have a look at Server Job Developer's Guide v7.5 page# 711.
You can better use
dsjob -jobinfo for retrieving current Job Status information of a Job.
Code: Select all
Job Status:
1. RUNNING
2. RUN OK
3. RUN with WARNINGS
4. RUN FAILED
5. VALIDATED OK
6. VALIDATE with WARNINGS
7. VALIDATION FAILED
8. RESET
9. STOPPED
10.NOT COMPILED
11.NOT RUNNING
Posted: Thu May 29, 2008 12:51 am
by ray.wurlod
These are NOT the correct job status codes. The correct job status codes are to be found in the JOBCONTROL.H header file in the DSINCLUDE directory (or by searching DSXchange).
Posted: Thu May 29, 2008 1:15 am
by ag_ram
ray.wurlod,
I did not list the Job Status Code, indeed but just listed out Job Status in words.
For your information:
Code: Select all
Job Status Code taken from JOBCONTROL.H
* Possible return values for token DSJ.STATUS:
Equ DSJS.RUNNING To 0 ;* This is the only status that means the job is actually running
Equ DSJS.RUNOK To 1 ;* Job finished a normal run with no warnings
Equ DSJS.RUNWARN To 2 ;* Job finished a normal run with warnings
Equ DSJS.RUNFAILED To 3 ;* Job finished a normal run with a fatal error
Equ DSJS.VALOK To 11 ;* Job finished a validation run with no warnings
Equ DSJS.VALWARN To 12 ;* Job finished a validation run with warnings
Equ DSJS.VALFAILED To 13 ;* Job failed a validation run
Equ DSJS.RESET To 21 ;* Job finished a reset run
Equ DSJS.CRASHED To 96 ;* Job has crashed
Equ DSJS.STOPPED To 97 ;* Job was stopped by operator intervention (can't tell run type)
Equ DSJS.NOTRUNNABLE To 98 ;* Job has not been compiled
Equ DSJS.NOTRUNNING To 99 ;* Any other status
Author(girish.rupkumar)
If you feel that the suggested two solutions can definitely resolve your problem, you can certainly go on helping future searchers by keeping your thread under resolved.
Posted: Thu May 29, 2008 6:48 am
by chulett
ag_ram wrote:I did not list the Job Status Code, indeed but just listed out Job Status in words.
But the fact that you
numbered them was... misleading.
ps. I'm a little confused by both locations mentioned where you can find this information on your own. There's no DSINCLUDE directory on my server, nor a DS_JOBOBJECTS.H or JOBCONTROL.H that I can find. Where I've always looked for all information of this nature is in:
$DSHOME/include/dsapi.h
Ahhh... found them. They are in the 'dsinclude' (lower case) subdirectory in each Project. DS_JOBOBJECTS.H is actually DSR_JOBOBJECTS.H but does not include this information. JOBCONTROL.H is more akin to what is in the Engine's dsapi header file.
Posted: Thu May 29, 2008 3:16 pm
by ray.wurlod
DSINCLUDE is upper case in the VOC file, and therefore you use the upper case variant in a $INCLUDE declaration.
As to DS_JOBOBJECTS.H, that is something that ag_ram incorporated; it does not exist (as Craig noted).
Posted: Thu May 29, 2008 10:03 pm
by ag_ram
A mistake, which has been corrected now in my post.