Page 1 of 1

Resetiing a job via shell script

Posted: Wed Jul 01, 2009 4:26 am
by sjordery
Hi All,

I have a scheduled data stage job run via below script on daily basis.

#! /usr/bin/sh
dshome=`cat /.dshome`;
export dshome
PATH=$PATH:$dshome/bin;
export PATH
. $dshome/dsenv

dsjob -run -param source_file=$1 Test_Project Seq_job.$2

Some times the job gets aborted due to avoidable issues like file didnt land because of market holiday yesterday.

So is it possible to add any command in the same script to reset the sequence job and all the jobs called from the sequence job if it has aborte last time?

Thanks in advance.
Sjordery.

Posted: Wed Jul 01, 2009 4:29 am
by ArndW
dsjob -run -mode RESET

Posted: Wed Jul 01, 2009 4:50 am
by sjordery
Thanks ArndW.
I tried that but its prompting with error

'Status code = -2 DSJE_BADSTATE
Error running job"

Does the command resets all the jobs called from the sequence jobs along with the main sequence job?
below is the script I am using.

-------------------------------------------------------------------------------------
#! /usr/bin/sh
dshome=`cat /.dshome`;
export dshome
PATH=$PATH:$dshome/bin;
export PATH
. $dshome/dsenv

dsjob -run -mode RESET -param source_file=$1 Test_Project Seq_job.$2

-------------------------------------------------------------------------------------

Thanks,
SJordery.

Posted: Wed Jul 01, 2009 5:55 am
by ArndW
You need 2 separate calls, the first to RESET, then the 2nd to run.

Posted: Wed Jul 01, 2009 6:10 am
by chulett
And no, it only resets the job mentioned on the command line, no others automagically. Your Sequence job should be setup to do the resetting of any 'child' jobs it runs using the 'Reset if required then run' option in the Job Activity stage.