How to Configure a Scheduled Task
0
Created On 04/27/20 11:04 AM - Last Modified 03/30/21 19:10 PM
Objective
You can run a command according to a recurring schedule, setting the start time, end time, and frequency. The task can be scheduled from the UI, in a script, or from the CLI. Some common use cases for scheduling a command to run include:
- Mirror a ticket from an external ticketing system.
- Send an email to a user, wait a certain amount of time, and if a response is not received, send the email again.
The example we will use for demonstration is the !Print command.
Important Notes
- Cron follows the time of the server that the script is running on.
- The clock icon for the task is blue when it is not scheduled, and orange when it is scheduled.
Unscheduled

Scheduled

Input
The inputs can be specified in the UI, a script, or the CLI.
| Argument | Description | Required |
| command | Command to schedule. | Required |
| cron | Scheduled time for the command to run (in Cron format). | Required |
| endDate | End time for the schedule to end (in Mon, 02 Jan 2019 15:04:04 EST format). | Optional |
| times | Number of times to run the command. | Optional |
Procedure
Command Entries (UI)
- Locate the command entry in the War Room and click the clock icon.
- Configure the schedule for the task.
Option Description Human View - Select whether you want this as a recurring task.
- Define the frequency that this task will run.
- Define the start time and end time for the task.
- To delete the task schedule, click Remove schedule
Cron View - Select whether you want this as a recurring task.
- Define the Cron expression (there are examples for reference).
- Define the start time and end time for the task.
- To delete the task schedule, click Remove schedule
Human View

Cron View

Demisto CLI
For this example, we use the two required arguments (command and cron) and an optional argument (times).
!ScheduleCommand command="!Print value=\"qqq\"" cron="*****" times="3"

Script
return executeCommand("ScheduleCommand", {
'command': "!Print value=\"qqq\"",
'cron': '* * * * *',
'times': 3
}