Page 1 of 1

How to reset the job if any job fails in project ?

Posted: Tue Jun 29, 2010 5:30 am
by vasam
Hi All,

I have a requirement like i want to reset the job if any job fails during the execution(system crash etc) in entire project?

my reqirement is

if any distaer happens my jobs are in abort status, so i want to reset all the jobs at a time?

Any idea?

thanks,
Vijay

Posted: Tue Jun 29, 2010 6:07 am
by ArndW
While not trivial, it is not difficult to implement. I would write a job sequence or shell script that retrieves the list of all jobs in project (using DSGetProjectInfo() or a dsjob call) and then, for each job, check the status and issue a reset call if that job state is aborted.

Posted: Tue Jun 29, 2010 6:16 am
by vasam
Thanks for ur reply,

can you please provide code if you have, that would be very helpful for me.

Thanks,
Vijay

Posted: Tue Jun 29, 2010 6:31 am
by Sreenivasulu
You can set this at the sequencer as well. There is a option 'Reset job if required'.
Regarding code - i.e invoking from a sheell - you need to go through the documentation and try out.

Regards
Sreeni

Posted: Tue Jun 29, 2010 6:32 am
by thanush9sep
Each Job Activity stage in sequence has a Execution Mode.
You can set it to "Reset if required, then run".
This will take care in any job fails

Posted: Tue Jun 29, 2010 6:33 am
by thanush9sep
Oops sorry one sec late....... :D

Posted: Tue Jun 29, 2010 6:45 am
by chulett
Which doesn't help the Sequence job itself or anything not run under the control of a Sequence for that matter. :wink:

Posted: Tue Jun 29, 2010 7:08 am
by vasam
Thanks for your reply,

Actually my req is i am not going to touch any job in the projects, what ever jobs available in particular project which are abot staus i want to Reset the job. I may use this job different project also.

Thanks,
Vijay

Posted: Tue Jun 29, 2010 7:13 am
by chulett
Okay... go ahead. Arnd has given you the solution, however the coding is all on you I'll wager. You can use dsjob for all of this, btw, if you'd rather script this than write a job.

Posted: Tue Jun 29, 2010 7:31 am
by ArndW
Give it a go - either through BASIC code or through scripting with dsjob and if you get stuck post your question to this thread. The general concensus here is that everyone is willing to supply assistance when people get stuck, but providing complete solutions is what many here get paid to do in our "real lifes" so it is unlikely that we'll do it here for free.

The corollary to the comments above which I use as my "acid test" of whether or not to respond is that if a poster hasn't put any effort into looking for a solution then I won't, either.

Back to the original question: there are 2 paths mentioned, so give one a try and post back here if you get stuck or have questions. But don't expect a complete solution to this non-trivial question.

Posted: Wed Jun 30, 2010 10:22 am
by laknar
First list the jobs using dsjob -ljobs projectname and write into file.

And then pass the jobnames using for loop

dsjob -jobstatus projectname jobname

Grep the status which ever you are looking for and reset it by using

dsjob -run -mode reset projectname jobname.