Retry "ScheduleCommand" when it fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Retry "ScheduleCommand" when it fails

L4 Transporter

Hello team,

We're deploying a programmed automation which sometimes fails due to an external error. We'd like to retry in case the command fails. The command used is "ScheduleCommand". How can this "retry" be created?

Thanks.

 

4 REPLIES 4

L5 Sessionator

Hi @Josep, might need more information. Does ScheduleCommand command need to be re-tried of the command that it calls. 

 

With the playbook task using the command that ScheduleCommand runs, in the below case I'm using Print. (Recommended method)

Screen Shot 2022-11-16 at 12.57.02 pm.png

If you insist on using the ScheduleCommand, then you will have to create a wrapper script. The scheduleEntry command calls itself. (This method is not recommended unless playbook approach won't work)

res = demisto.executeCommand("Print", { "value" : "This is a test"})[0]

# Test res to verify if the command was successful. Code would depend on the automation your running.

# If command failed re-run
if cortexIncident['status'] != 1: # Test to check the outcome of res, dummy code
    exit(0)
else: # Schedule the next run
    demisto.executeCommand("scheduleEntry", { 'command' : 'wrapperSchedule', 'cron' : '1 * * * *', 'times' : 1 })

 

Thanks for the reply,

"On Error" option does not appear in our XSOAR tasks.

You're right more info is needed, I refer to the command that calls inside "ScheduleCommand"

L5 Sessionator

Hi @Josep, in older versions of Cortex the option is available under the advanced tab. Screenshot below.

Screen Shot 2022-11-17 at 1.14.55 pm.png

  • 1516 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!