JobRun getJobRunHadErrors will tell you if the job run completed w/ an error or not. i'm not sure what you mean by saying "this only tells if job has been started without errors, not about his result itself." - why do you think that is the case ? is the job still running when you run the getJobRunHadErrors command ?
yes, exactly... please note timestamps below...
returned result of JobRun getJobRunHadErrors, result by manual says : "job run did not have errors", but it is not true if we suppose it should say "the job run completed w/ an error or not."
Info Dec 22, 2014 3:23:46 PM falseJob run result: false
initiated job, note final timestamp and also that job failed... and between 3:23:46 and 3:24:44 were obvisously more executed commands...
Info Dec 22, 2014 3:23:45 PM Started running the job 'ServiceStart-Complete' with priority 'NORMAL' on application server 'blappprod06s'(10) Info Dec 22, 2014 3:23:48 PM Executing work item NSH Script Job:ServiceStart-Complete; Server:IX2012.IX.LOCAL; on application server: blappprod03 Error Dec 22, 2014 3:24:44 PM The job 'ServiceStart-Complete' has failed
I suppose that there is no possibility that logging has "time-drift" with timestamps...
But if JobRun getJobRunHadErrors tells that currently there is no errors, that should mean, that I have to check somehow job status...
Well, are you running the jobRunHadErrors while the job is running? if so, then of course it won’t return a result that happens after you run it… if you wait until the job has completed and run the jobRunHadErrors, does it return correctly ?
yes it is working now... but still I must to check job status, because every job which I am calling by defined function can have different duration... anyway thank you