Page 1 of 1
Command for reseting jobs if required and the execute
Posted: Mon Mar 07, 2011 7:37 pm
by soportesis
Hello,
Is there a command option with the "dsjob" used reseting jobs if required and the execute??
Thanks in advance,
Frankie 22''
Posted: Mon Mar 07, 2011 8:20 pm
by ray.wurlod
No, this is only available in sequences.
However you could script dsjob -jobinfo to determine the job's status then dsjob -run -mode RESET if necessary then dsjob -run -mode NORMAL to actually run the job. (Option -mode NORMAL can be omitted.)
Posted: Mon Mar 07, 2011 9:17 pm
by chulett
Exactly. In other words you have to replicate the steps that the Job Activity stage does for you automatically... thankfully, it's a pretty straight-forward and simple task.
Posted: Tue Mar 08, 2011 11:03 am
by soportesis
OK, Tnks a lot
Posted: Tue Mar 08, 2011 5:08 pm
by kduke
Here is a code snippet.
Code: Select all
# -----------------------------------------------------------------
# Check current job status here
# -----------------------------------------------------------------
DsJobStatus=`$DSPath/dsjob -jobinfo $ProjectName $JobName | head -1 | cut -d"(" -f2 | cut -d")" -f1`
case $DsJobStatus in
# -----------------------------------------------------------------
# 0 "Running"
# -----------------------------------------------------------------
0)
print " ERROR: Job $JobName already running."
exit 1
;;
# -----------------------------------------------------------------
# Runnable Job Status (do nothing)
# 1 "Finished"
# 2 "Finished (see log)"
# 9 "Has been reset"
# 11 "Validated OK"
# 12 "Validated (see log)"
# 21 "Has been reset"
# 99 "Compiled"
# -----------------------------------------------------------------
1|2|7|9|11|12|21|99)
:
;;
# -----------------------------------------------------------------
# NOT Runnable Job Status (reset job)
# 0 "Running"
# 3 "Aborted"
# 8 "Failed validation"
# 13 "Failed validation"
# 96 "Aborted"
# 97 "Stopped"
# 98 "Not Compiled"
# -----------------------------------------------------------------
*)
$DSPath/dsjob -run -mode RESET -wait -jobstatus $ProjectName $JobName
ReturnCode=$?
if (( $ReturnCode==21 ))
then
:
else
print
print " ERROR: Unable to reset job $ProjectName $JobName"
exit 3
fi
esac