Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:adm:create_and_configure_trigger [2018/12/28 13:48]
kotisovam
tutorial:adm:create_and_configure_trigger [2020/05/13 14:42]
apeterova [Cron trigger]
Line 1: Line 1:
 +====== Task Scheduler - create and configure a trigger ======
  
 +A trigger is a tool in CzechIdM that initiates scheduled tasks. At the moment, there are three types of triggers. We can schedule a task to commence just once, periodically or after another scheduled task has successfully finished. Let's start with newly created scheduled tasks. (Tutorial for [[tutorial:adm:how_to_work_with_task_scheduler|scheduled tasks]])
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_01.png |}}
 +
 +So we have three scheduled tasks, none of them has any trigger. Let´s start with the first scheduled task (by description). Click on the **Add** button in **Scheduled starts** and a pop-up window will show up. 
 +
 +We have four types of triggers:
 +  * Once time start trigger - task starts once in configured date and time.
 +  * Repeated start trigger - configure period to repeated task start. Configured period is converted to cron expression on the background.
 +  * Cron trigger - cron expression can be configured directly.
 +  * Other task trigger - task is started after other (dependent) task ends.
 +
 +==== Once time start trigger ====
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_02.png |}}
 +
 +On **the first scheduled task** we will configure a trigger which will start the scheduled task just once. For type, choose **One-time start** and in **Fire time** by clicking on "calendar" select the date and at the bottom of the calendar menu click on "hours" and select the time.
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_03.png |}}
 +
 +We have now configured a scheduled task and a date is set when it will be initiated. After that start, the trigger will disappear and we can select a new trigger.
 +Now click the **Add** trigger button next to **the second scheduled task**.
 +
 +==== Repeated start trigger ====
 +
 +{{ :tutorial:adm:repeated-trigger.png |}}
 +
 +
 +Now select the trigger type **Repeated start**. We can choose interval from prepared options which could start the scheduled task periodically from given valid date.
 +Configured period is converted to cron expression on the background. Behavior is the same as cron trigger, which is described below.
 +
 +
 +==== Cron trigger ====
 +
 +{{ :tutorial:adm:cron-trigger.png |}}
 +
 +Now select the trigger type **Cron**. In **Cron expression** field you can add an expression which could start the scheduled task periodically. We set **0 0 7 * * ?**, meaning the scheduled task will be started every day at 7 AM. When valid date is configured, then first start of the task will be postponed to given date.
 +
 +Cron expression tutorial: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html
 +
 +Other common combinations:
 +  * **0 0 * * * ?** - start the task every hour
 +  * **0 0 7 * * ?** - start the task every day at 7 AM
 +  * **0 0 5 ? * MON** - start the task every monday at 5 AM
 +  * **0 0 11/12 * * ?** - start the task twice every day - at 11 AM and at 11 PM
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_05.png |}}
 +
 +In the picture above, we can see another trigger and the next scheduled start is tomorrow on 31st January at 7 AM. This trigger will not disappear after that date, but will be updated to another start.
 +
 +==== Other task trigger ====
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_06.png |}}
 +
 +Now we add the trigger to the last scheduled task and in **Type** select **Other task**. In **Other task** field select another scheduled task, but as you can see on the picture above, scheduled tasks are represented by their description, because there can be more scheduled tasks with same task type. In this tutorial we selected **the second scheduled task**.
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_07.png |}}
 +
 +In the picture above, you can see **the third scheduled task** has a trigger with another task. After this task (in our case **the second task**) has successfully finished, **the third scheduled task** will start.
 +
 +{{ :tutorial:adm:scheduled_tasks_trigger_08.png |}}
 +
 +If we click on the scheduled task in trigger, a pop-up will show the details of that scheduled task.
  • by apeterova