Skip to main content Skip to complementary content

Configuring a Cron trigger for Job tasks

Use a Cron trigger to execute your Job task on a regular basis over a period of time.

A Cron expression is a string consisting of five, six, or seven fields separated by white space. These fields can contain any of the allowed values with various combinations of the allowed characters depending on the field.

Before you begin

You must have the Execute permission on the workspace where the task is located to configure the Schedule steps when creating or editing a task.

Procedure

  1. If you are editing your task after it has been created, go to its details page, then click the Edit trigger icon next to Trigger.
  2. Click the Add trigger icon.
  3. Enter the name of the trigger.
    The name must contain only alphanumeric, -, # and _ characters. Spaces and other special characters are not allowed.
  4. Select Cron from the Trigger type drop-down list.
  5. In the Location (time zone) field, define the time zone for your executions.
  6. Enter the start date of the run.
  7. Specify values for the following fields:
    The following table presents the options used to define a Cron trigger
    Field Description Allowed values and characters
    Minutes Minutes at which you want to execute the task.
    • 0 - 59
    • , * / -

      */5 (every 5 minutes) is the minimum interval possible.

      Note that the CRON scheduler resets at the start of each hour, regardless of the specified interval. Ensure that the minute interval in your CRON expression always results in the last scheduled execution of each hour happening at least 5 minutes before the top of the hour. Otherwise, the expression cannot be saved.

      It is recommended to set an interval that is a multiple of 5. If you use a different interval, calculate it carefully to avoid this limitation, or set the minute interval for only one hour, such as */7 12 * * *, which schedules tasks every 7 minutes for one hour. This ensures the scheduler stops without risking a shorter final interval at the end of the hour.

    Hours Hours at which you want to execute the task.
    • 0 - 23
    • , * / -
    Day of month Day of the month on which you want to execute the task.
    • 1 - 31
    • , * / - ? L W
    Months Months in which you want to execute the task.
    • 1 - 12
    • JAN - DEC
    • , * / -
    Day of week Day of the week on which you want to execute the task.
    • 1 - 7
    • SUN - SAT
    • , * / - ? L #
    Years Years in which you want to execute the task.
    • Empty, from the current year to 2099
    • , * / -

    You can also copy/paste a Cron expression already defined with five, six, or seven fields.

    When copying and pasting an expression of five fields with no value in the Years field, an asterisk is added automatically in this field.

    When copying and pasting an expression of seven fields, the first one is considered as seconds and is ignored as seconds are not supported.

    Here is the list of the allowed characters:
    • The comma ( , ) specifies a list of values. For example, 2,5,6 in Day of week means Monday, Thursday, and Friday.

    • The asterisk ( * ) specifies any possible value for a field. For example, an asterisk in Months means every month.

    • The slash ( / ) specifies an interval value. Use a number in front of the slash to set the initial value. For example, 9/10 in Hours means every 10 hours starting at 09:00. You can also use an asterisk in front of the slash, such as */10 in Hours means every 10 hours.

    • The dash ( - ) specifies a range of values. For example, 15-17 is equivalent to 15, 16, 17.

    • The question mark ( ? ) specifies "no specific value" in the Day of month and Day of week fields.

      • Use the question mark in Day of month when you specify something in the Day of week field. For example, you configure a trigger to start on the fifth day of the week without specifying a particular day of the month. Enter ? in Day of month and 5 in Day of week.

      • Use the question mark in Day of week when you specify something in the Day of month field. For example, you configure a trigger to start on the fifth day of the month without specifying a particular day of the week. Enter 5 in Day of month and ? in Day of week.

    • The L character specifies the last day of the month in Day of month and the last day of the week or the last x day of the month in Day of week.

      • Use the L character in Day of month to specify the last day of the selected month. For example, it will be day 31 for March or 29 for February in leap years.

      • Use the L character in Day of week to specify the last day of the week. It will be 7 or SAT. You can also use the L character after another value to specify the last x day of the month. For example, 5L means the last Thursday of the month.

      It is not recommended to combine a list or range of values with the L.

    • The W character specifies the weekday (Monday-Friday) nearest the given day in Day of month. For example 10W means the nearest weekday to the 10th of the month.

    • The number sign ( # ) specifies the nth x day of the month in Day of week. For example, 5#1 means the first Thursday of the month (5 means Thursday and #1 means the first one in the month).

    The following table presents examples of Cron expressions and their meaning
    Cron expression Description
    15 10 ? * 6L * Execute the task at 10:15 am, on the last Friday of every month
    15 10 ? * 6L 2022-2024 Execute the task at 10:15 am, on every last Friday of every month, during the years 2022, 2023, and 2024
    15 10 ? * 6#3 2022-2024 Execute the task at 10:15 am, on the third Friday of every month, during the years 2022, 2023, and 2024
  8. Optional: Set the trigger timeout by selecting Same as task, No timeout or Custom.
    By default, the trigger timeout value is the same as the task timeout.
    Trigger timeout overrides task timeout.
  9. Click Save and close.

Results

A confirmation message is displayed at the top of the page. You are redirected to the task details page. The schedule you have defined appears under Trigger > Trigger type > Cron.

You can also view the schedule in the Tasks tab. Click the Triggers and plans icon.

Troubleshooting:

If you have selected a time zone with Daylight saving time (DST) changes for your schedule, the transition of Daylight saving time affects the execution schedule since a time interval is repeated due to this transition, and thus the next actual execution is adjusted accordingly. For further information, see Schedules with DST.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!