Orchestrator
2023.4
False
使用 CRON 表达式
Orchestrator 用户指南
上次更新日期 2024年4月19日
使用 CRON 表达式
CRON 是一个软件实用程序,存在于类 Unix 操作系统中,用于基于时间的计划。它使用由空格分隔的 6 个字段(如果包括年,则为 7 个字段)组成的字符串,提供高度可自定义的重复任务计划。字符串的格式为
seconds
minutes
hours
day of the month
month
day of the week
year
。
在 Orchestrator 中,cron 表达式基于使用后台任务的内部计划库,在使用“高级计划”选项创建时间触发器时需要用到这类表达式:
CRON 表达式中的每个字段都有一个指定的值范围和特殊字符,可用于创建计划,如下所述:
字段 |
必需 |
允许的值 |
允许的特殊字符 |
---|---|---|---|
|
是 |
0 - 59 |
, - * / |
|
是 |
0 - 59 |
, - * / |
|
是 |
0 - 23 |
, - * / |
|
是 |
1 - 31 |
, - * / ? L W |
|
是 |
1 - 12 or JAN - DEC |
, - * / |
|
是 |
1 - 7 or SUN - SAT |
, - * / ? L # |
|
否 |
空格或
1970 - 2099 |
, - * / |
可用特殊字符的含义和用法如下所示:
字符 |
描述 |
示例 |
---|---|---|
|
用于表示给定字段的所有值。 |
* * * ? * * would trigger every second, whereas 0 * * ? * * would trigger every minute, more specifically at second 0 of each minute.
|
|
用于表示未指定任何值。只能在
day of the month 或 day of the week 字段中使用。
|
0 0 0 15 * ? * would trigger at midnight on the 15th day of each month, whereas 0 0 0 ? * 2 * would trigger at midnight each Monday.
|
|
用于表示值范围。 |
0 0 9-17 ? * 2-6 would trigger every hour from 9:00am until 5:00pm on Monday through Friday.
|
|
用于表示附加值。 |
0 0 9-17 ? * MON,WED,FRI would trigger every hour from 9:00am until 5:00pm on Mondays, Wednesdays, and Fridays.
|
|
用于表示给定字段的增量。 |
0 0 0/3 ? * 2/7 would trigger every three hours, on Mondays, beginning at midnight.
|
|
用于表示“Last”。只能在
day of the month 或 day of the week 字段中使用。对于 day of the week ,可以在另一个值后面使用(例如 6L )来表示上星期五。
|
59 59 23 L * ? would trigger at 11:59:59pm on the last day of each month, whereas 59 59 23 ? * 6L would trigger at the same time but only on the last Friday of each month.
|
|
用于表示距给定值最近的工作日。只能在
day of the month 字段中使用。
|
0 0 0 15W * ? would trigger at midnight of the nearest weekday to the 15th, every month. If the 15th is a Saturday, it would trigger on Friday the 14th, whereas if the 15th is Sunday, it will trigger on Monday the 16th.
|
|
用于表示给定值的每月出现次数,例如第一个星期五或第四个星期四。只能在
day of the week 字段中使用。
|
0 0 17 ? * 6#1 would trigger at 5:00pm on the first Friday of every month.
|