Schedule
Overview
The Schedule is a trigger that enables users to automate their workflow at specific intervals. It aids in designing complex, time-sensitive automation processes.
The Schedule provides us with numerous triggers to address time-related issues. We will explore each trigger one by one to gain a better understanding of it.
Every X Minutes
Used to activate the current flow every X minutes.
For example, every 5 minutes, the flow will run once and start from the beginning.
Every Hour
Used to activate the current flow every hour from Monday to Friday. You can enable it to run on both Saturday and Sunday.
Every Day
Used to activate the current flow every day from Monday to Friday.
You can choose the time frame to run during the day and enable it to run on both Saturday and Sunday.
Every Week
Used to activate the current flow every week.
You can choose the day of the week and the time of day it runs.
Every Month
Used to activate the current flow every month.
You can choose a specific day in that month and a running time frame of the day.
Cron Expression
Used to trigger the current flow to run according to a Cron expression if the above samples do not meet your needs.
A Cron expression is a piece of text with a format of 5 or 7 fields used to determine the running schedule for a method, function, or application.
* * * * *
| | | | |
| | | | +---- Day of the week (0 - 6) (Sunday = 0 or 7)
| | | +------ Month (1 - 12 or JAN - DEC)
| | +-------- Day of the month (1 - 31)
| +---------- Hour (0 - 23)
+------------ Minute (0 - 59)
When you combine all these layers, you will have a complete Cron expression to schedule the execution of tasks periodically.
Special characters in Cron Expression
SPECIAL CHARACTER | WHAT IT MEANS IN CRON EXPRESSION |
---|---|
* (“all values”) | Used to select all values in a field. For example, * in the minute field means "every minute" and * in the month field means every month. |
? (“no specific value”) | Used to indicate no specific value, i.e., when the value doesn't matter. For example, if you want the instance to run on a particular day of the month (say, the 10th), but don't care what day of the week that happens to be, you would put "10" in the day-of-month field, and "?" in the day-of-week field. |
- | Used to specify a range. For example, "10-12" in the hour field means "the hours 10, 11 and 12". |
, | Used to specify additional values. For example, "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday." |
/ | Used to specify increments. For example, "5/15" in the seconds field means "run the instance every 15 seconds starting at second 5. This would be at the seconds 5, 20, 35, and 50". "1/3" in the day-of-month field means "run the instance every 3 days starting on the first day of the month". |
L (“last”) | This character has different meaning in day of month and day of week. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last Friday of the month". When using the "L" option, it is important not to specify lists, or ranges of values. |
W (“weekday”) | Used to specify the weekday (Monday-Friday) nearest the given day. For example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the instance will run on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not jump over the boundary of a month's days. The "W" character can only be specified when the day-of-month is a single day, not a range or list of days. |
# | Used to specify "the nth" day of the month. For example, the value of "6#3" in the day-of-week field means "the third Friday of the month" (day 6 = Friday and "#3" = the 3rd one in the month). "2#1" = The first Monday of the month "4#5" = The fifth Wednesday of the month. Note: If you specify "#5" and there is no 5th occurrence of the given day of the week in the month, then no run will occur that month. |
Characters in the months and day-of-week fields are not case-sensitive. FRI is similar to fri.
Cron Expression Examples
Expression | Meaning | |
---|---|---|
0 12 * * ? | At 12:00 p.m. (noon) every day | |
0/15 0 * * ? | Every 15 minutes every day | |
1/2 0 * * ? | Also, we can use increments to run the job every odd minute | |
0/5 13,18 * * ? | Every five minutes starting at 1 p.m. and ending at 1:55 p.m. and then starting at 6 p.m. and ending at 6:55 p.m., every day | |
0-5 13 * * ? | Every minute starting at 1 p.m. and ending at 1:05 p.m., every day | |
15,45 13 ? 6 Tue | At 1:15 p.m. and 1:45 p.m. every Tuesday in the month of June | |
30 9 ? * MON-FRI | At 9:30 a.m. every Monday, Tuesday, Wednesday, Thursday and Friday | |
30 9 15 * ? | At 9:30 a.m. on the 15th day of every month | |
0 18 L * ? | At 6 p.m. on the last day of every month | |
0 10 ? * 2#3 | At 10 a.m. on the third Monday of every month |
Triggers
Every X Minutes
Every Hour
Every Day
Every Week
Every Month
Cron Expression
Actions
Not currently supported