How to Configure a Scheduled Task

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.

ArgumentDescriptionRequired
commandCommand to schedule.Required
cronScheduled time for the command to run (in Cron format).Required
endDateEnd time for the schedule to end (in Mon, 02 Jan 2019 15:04:04 EST format).Optional
timesNumber of times to run the command.Optional

 

 



Procedure


Command Entries (UI)


  1. Locate the command entry in the War Room and click the clock icon.
  2. Configure the schedule for the task.
    OptionDescription
    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
}


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000PPosCAG&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail