Automic Workload Automation

Expand all | Collapse all

HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

Pete Wirfs

Pete WirfsDec 08, 2017 06:25 PM

  • 1.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Sep 08, 2017 09:27 AM
    Do anyone know how we can implement this requirement if oracle  remote agent job gets failed then how we can restart it till  5times if it gets fails again and again. Please help on priority


  • 2.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Sep 08, 2017 09:39 AM
    Start it with ACTIVATE_UC_OBJECT with the "wait" keyword from an Automic script, check the return code each time, restart it four more times unless it ran succesfully, comes to mind.

    There's an example on the function, including checking of the return code here:
    https://docs.automic.com/documentation/webhelp/english/AWA/11.2/AE/11.2/All%20Guides/Content/ucaafh.htm

    On a related note, any solution that depends on "restart it so many times until it works" always strikes me as potentially having a more elegant solution hidden somewhere, that desperatly wants to get out.


  • 3.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Sep 08, 2017 10:29 AM
    Correction:

    UC_ACTIVATE_OBJECT, even with "wait", only ever gives you the runId, or code "0" if activation failed. Upon reading up on it further, it appears it does not ever give you an actual error code for the job started by it, but only for its activation.

    So you probably need to evaluate activation success, and then evaluate the success of the oracle job itself with another script function. GET_STATISTIC_DETAIL(runid, STATUS) should work, any return from 1900 to 1999 means your Oracle job ran OK.

    Or, you could possibly use post conditions, see this thread:
    https://community.automic.com/discussion/6034/script-in-object-to-restart-itself-3-times-than-fail


  • 4.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Sep 08, 2017 11:17 AM
    I just tested this workflow post-condition trick.  It ran the task 4 times and then it stopped trying.

    x3v92ug1hs06.pnghttps://us.v-cdn.net/5019921/uploads/editor/0b/x3v92ug1hs06.png" width="503">



  • 5.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Sep 08, 2017 02:48 PM
    Yes, Petes PostCondition Solution is the most simple&convenient for your rquirement.
    Al others would need more scripting effort.


  • 6.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 08, 2017 12:26 PM
    Hi Pete,

    I am having the same issue but I am unable to perform in 12.0.1 can you please let me know the process


  • 7.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 08, 2017 04:22 PM
    pavan_reddy_9939   Is your task inside of a workflow?  The trick I posted only works under task properties inside of a workflow.


  • 8.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 08, 2017 06:08 PM
    Yeah Pete my Task is inside the Workflow.I have tried it but it is failing



  • 9.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 08, 2017 06:12 PM

    The below is the image which I have tried in my Workflow


    5mem9c7f4fto.pnghttps://us.v-cdn.net/5019921/uploads/editor/xr/5mem9c7f4fto.png" width="1249">


  • 10.  HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 08, 2017 06:25 PM
    Your "FINALLY" needs to be above the "ELSE".


  • 11.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Nov 13, 2018 03:58 PM

    Hi Pete,

     

    We do have a same scenario to make a auto restart of the Workflows with out manual intervention and below is the Screen shot which i am using in my One Automation 12.0.1 version.Can you help me out here if i am wrong at some point?

     



  • 12.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Nov 13, 2018 05:27 PM

    I strongly recommend testing postcondition logic.  In this case you could build a test-job that always fails (I like to run the DOS command "EXIT 1"), wrap a workflow around it with your postcondition rule, and execute it to see what happens.



  • 13.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Nov 15, 2018 01:17 PM

    Thanks Pete,it's working fine now.



  • 14.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 05, 2018 04:16 PM

    Hi Pete,

     

    Can we have your advice/Suggestion how we can over come this Situation.

     

    We are having Pre-condition check where it will checks for one of the handshake condition if it is not met then the Workflow will fail Automatically So, we have asked Developers to add a return code in Unix Script and planned to add a Post condition to my Workflow to check  return Code and make the Auto restart of workflow which checking that return Code they developed the return code as 10 in unix Shell script when i kept over Same in my One Automation the Workflow is failing with return Code as '01'.

     

    Can you please help us.



  • 15.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 05, 2018 05:51 PM

    The PostCondition rule does not execute if the PreCondition rule causes the task to SKIP.   I don't know what you are doing in your PreCondition, but perhaps you could re-engineer it to occur in the top of the Process script instead of the PreCondition?



  • 16.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 06, 2018 09:25 AM

    Hi Pete,

     

    Good morning,

     

    I didn't kept any Precondition for it.

     

    The below is my question i am having now how to achieve it from One Automation.

     

    We came to know as there is an issue related to Mobile Handshake which is getting failed on daily basis on most of the days. To overcome this one we are planning to create a Post Condition from One Automation itself to make a restart of the Workflow Automatically without any manual intervention from Prod ops and to overcome this one in One Automation instead of going with Unix Script and having the Sleep Mode option. We required a Specific return code from Unix script which returns if the Workflow is failed due to the Handshake because if we keep the Condition as <>0 at that point of time if the Workflow is failed due to any Server issues or table drop issues also it will be Auto restarted which is not the ideal case to run any Workflow.So,we required your help in setting an Return code in Unix Script where we can have a Specific Code apart from 0 and 01 which were related to Success and failure of any Workflows .If we have that return code Specific to Handshake then we can have it in One Automation and make an Auto restart Condition.

     

    For this our developers created a Return code in Unix Script as 10 if it fails due to handshake but in one Automation the job is failing and Still it is returning as 01 code where i came to know that it will return same as failure.Now,i required to have the Auto restart if it fails for Handshake condition for which it return return code in Unix script and i want to get Automation restart at code only not for other issues for that Workflow.Can i know whether do i need to keep anything in Process tab for the Unix job?

     

    Can i have your Suggestions ?



  • 17.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 06, 2018 07:13 PM

    I mostly do Windows, so I am not the best resource for Unix behavioral issues.

     

    If I understand you correctly, you have an application that is setting RC=0010, but the UC4/Unix agent sees the failure as RC=0001.     I would be trying to figure out why.   There are many possibilities.

     

    Maybe the application is setting it back to RC=0001 before it finishes execution? 

    Maybe you have another process script instruction executing after the application that sets it back to RC=0001? 

    Maybe you have the OutputScan feature turned on and it is setting RC=0001?

    Maybe this is a normal behavior of the UC4/Unix agent?

     

    I hope someone with more Unix experience could chime in here?



  • 18.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 07, 2018 04:45 PM

    Hi Pete,

     

    Thanks for your response and it was solved out as we found out there is Some issue with the unix Frame Work it self and now it got resolved .



  • 19.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 07, 2018 04:26 PM

    Hi

     

    I have a bit unix experience but I am not sure if I understand this crorrectly...

    As far as I understood your handshake function should throw a specific Return code <> 0 and 1 if it fails.

     

    But it does not...

     

    how is your job - and specially the exit funtion for setting the RC set up?

    which RC do you get from the agent?

    which version of automic & linux do you use?

     

    cheers, Wolfgang



  • 20.  Re: HIGH PRIORITY : Auto restart 5 times oracle job in the workflow if that job fails

    Posted Dec 07, 2018 04:46 PM

    Hi Wolfgang,

     

    Thanks for your response and it was solved out as we found out there is Some issue with the unix Frame Work it self and now it got resolved .

     

    which RC do you get from the agent?--earlier only 01 now it got fixed by the Script

    which version of automic & linux do you use? Automic 12.0.1