Skip to main content Skip to complementary content

Tasks - Custom option

When creating a task, the option Custom offers great flexibility for the scheduling of a task. It is important to be familiar with the syntax for the respective fields, Filter and Increment to create well-functioning tasks. This topic details the options when using a Custom schedule.

Filter

What you set as a filter is when a task can be triggered, not the opposite. The filter defines the conditions for a task.

The default syntax for the filter is "* * - * * * * *". There should be no spaces in the filter other than between each position. The space character is used as a delimiter between the positions, and inserting one would most likely cause an error in the filter.

Positions

Left to right (first position is 0), each position is explained here.

Legend: 1-60. ‘*’ = all

Which minute of an hour (0 - 60) that a task can be triggered.

Legend: 1-24. ‘*’ = all

Which hour of a day (1-24) that a task can be triggered.

Legend: 1-4. ‘¤’ = last. ‘-’ = none

WeekDayPrefix works together with WeekDay by adding a prefix. With WeekDayPrefix, you can state that only the last (¤) Friday in a given month or first (1) Saturday in a given month that a task can be triggered.

Syntax: Position 3 - WeekDay

Legend: 0-6 (where Sunday is 0)

Which weekday that a task can be triggered.

Legend: An integer. ‘*’ = all

The task can be triggered every n:th week, where n is the number set in this position.

Legend: 1-31. ‘*’ = all. ‘¤’ = last

Which day of a month that a task can be triggered. Using last (¤), the task will be triggered on the last day of a month, which is checked dynamically depending on month (and leap year).

Information noteFor Microsoft Windows users: You can add the last symbol (¤) by holding Alt and typing 0164 on the numeric keypad.

Legend: 1-12. ‘*’ = all

Which month of a year that a task can be triggered.

Legend: an integer. ‘*’ = all

How many months that must pass before a task can be triggered.

For Minute, Hour, WeekDay, DayOfMonth and Month, you can use syntax with hyphen (-) to state “From - To”. For WeekDayPrefix, WeeklyInterval, and MonthlyInterval, you must state each character to be used in the filter. This option can also be used by Minute, Hour, WeekDay, DayOfMonth, and Month.

Example: You only want to allow a task the first 15 minutes of each hour. You can either put ‘1-15’ or ‘1,2,3,4,5,6,7,8,9,10,11,12,13,14,15’ in the first position.

Increment

Default: "0 0 0 0"

If the default increment is used, that is “0 0 0 0”, the task will only be triggered once.

Left to right (first position is 0) each position is explained here.

How many minutes to increment.

How many hours to increment.

How many days to increment.

How many weeks to increment.

General guidelines

  • An hourly task, with higher frequency than once per hour, should set Minutes to an appropriate figure.

  • An hourly task, with a frequency of once every hour or less, should set Hours to an appropriate figure.

  • A daily task should set Days to an appropriate figure.

  • A weekly or monthly trigger should set Days to an appropriate figure if any filter exists because they are based on daily evaluations (such as run every Thursday and Saturday every 4 weeks, or the 5th, 10th, and 15th day every month).

  • If no filter exists, the increment should match how often the task should trigger.

Examples

Here are a few examples on how to set up a task.

Certain hour and minutes

Premise: The task should only trigger between 11.15 and 11.59 (any day).

The following filter only allows a task to be triggered between 11.15 and 11.59 any given day of the year.

Filter: “15-59 11 - * * * * *

Explanation: Position 0 is ‘15-59’ which means it will only trigger during those minutes.

Position 1 is ‘11’ which means it will only trigger during that hour.

Increment for this task is based on what is to be accomplished, but there are pitfalls. Most notably, if you are scheduling a task, and the start time is outside of 11.15 - 11.59, say 12.15, and the increment is set to advance one day at a time, this task will never trigger. Most likely the increment should be every n hours or every n minutes.

Using WeekDayPrefix

Premise: The task should only trigger the first Monday every month.

Filter: “* * 1 1 * * * *

Explanation: Position 2 is set to ‘1’ which means the first of the later given weekdays is allowed. Position 3 is set to ‘1’ which means only Mondays (0 is Sunday) are allowed for this task.

This task should increment one day, that is,“0 0 1 0”.

Certain date in a month

Case 1

Premise: Run the first every month.

Filter: “* * - * * 1 * *

Explanation: Position 5 is set to ‘1’ which means the only day number 1 in any given month is allowed for this task.

This task should increment one day, that is,“0 0 1 0”.

Case 2

Premise: Run the last day every month.

Filter: “* * - * * ¤ * *

Explanation: Position 5 is set to ‘¤’ which means the only last day in any given month is allowed for this task.

This task should increment one day, that is,“0 0 1 0”.

Case 3

Premise: Run the last day each year.

Filter: “* * - * * ¤ 12 *

Explanation: Position 5 is set to ‘¤’ which means the last day in any given month is allowed for this task. Position 6 is set to ‘12’ which means only the 12th month (December) is allowed for this task.

This task should increment one day, that is,“0 0 1 0”.

Certain weekdays

Premise: Run Monday and Wednesday every week.

Filter: “* * - 1,3 * * * *

Explanation: Position 4 is set to ‘1,3’ which means only Monday and Wednesday are allowed for this task (0 is Sunday).

This task should increment one day, that is, “0 0 1 0”.

Using WeekDayPrefix, WeekDay, and Month

Premise: Run last Friday every other month.

Filter: “* * ¤ 5 * * 1,3,5,7,9,11 *

Explanation: Position 3 is set to ‘¤’ which means the last weekday given in Position 4. Position 4 is set to ‘5’ which means Friday (Sunday is 0) is allowed for this task. Together they read ‘Last Friday’. Position 6 is set to ‘1,3,5,7,9,11’ which means only those months are allowed for this task.

This task should increment one day, that is, “0 0 1 0”.

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 – let us know how we can improve!