- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
11-14-2022 11:32 PM - edited 11-15-2022 02:41 AM
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.
11-15-2022 06:07 PM
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)
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 })
11-16-2022 12:20 AM
Thanks for the reply,
"On Error" option does not appear in our XSOAR tasks.
11-16-2022 03:34 AM
You're right more info is needed, I refer to the command that calls inside "ScheduleCommand"
11-16-2022 06:16 PM
Hi @Josep, in older versions of Cortex the option is available under the advanced tab. Screenshot below.
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!