调度触发器节点#
¥Schedule Trigger node
使用计划触发器节点按固定时间间隔和时间运行工作流。其工作方式类似于类 Unix 系统中的 Cron 软件实用程序。
¥Use the Schedule Trigger node to run workflows at fixed intervals and times. This works in a similar way to the Cron software utility in Unix-like systems.
You must activate the workflow
如果工作流使用“计划”节点作为触发器,请确保保存并激活该工作流。
¥If a workflow uses the Schedule node as a trigger, make sure that you save and activate the workflow.
Timezone settings
The node relies on the timezone setting. n8n uses either:
- The workflow timezone, if set. Refer to Workflow settings for more information.
- The n8n instance timezone, if the workflow timezone isn't set. The default is
America/New Yorkfor self-hosted instances. n8n Cloud tries to detect the instance owner's timezone when they sign up, falling back to GMT as the default. Self-hosted users can change the instance setting using Environment variables. Cloud admins can change the instance timezone in the Admin dashboard.
节点参数#
¥Node parameters
添加触发规则以确定触发器何时运行。
¥Add Trigger Rules to determine when the trigger should run.
使用触发间隔选择触发的时间间隔单位。所有其他参数取决于你选择的间隔。选择以下选项:
¥Use the Trigger Interval to select the time interval unit of measure to schedule the trigger for. All other parameters depend on the interval you select. Choose from:
你可以添加多个触发规则,以便按不同的计划运行节点。
¥You can add multiple Trigger Rules to run the node on different schedules.
请参阅以下各节,了解有关配置每个触发间隔的更多详细信息。请参阅 模板和示例 以了解更多示例。
¥Refer to the sections below for more detail on configuring each Trigger Interval. Refer to Templates and examples for further examples.
秒触发间隔#
¥Seconds trigger interval
- 触发间隔:输入每次工作流触发之间的间隔时间(秒数)。例如,如果你在此处输入
30,则触发器将每 30 秒运行一次。
¥Seconds Between Triggers: Enter the number of seconds between each workflow trigger. For example, if you enter 30 here, the trigger will run every 30 seconds.
分钟触发间隔#
¥Minutes trigger interval
- 触发间隔分钟数:输入每次工作流触发之间的间隔时间(分钟数)。例如,如果你在此处输入
5,则触发器将每 5 分钟运行一次。
¥Minutes Between Triggers: Enter the number of minutes between each workflow trigger. For example, if you enter 5 here, the trigger will run every 5 minutes.
小时触发间隔#
¥Hours trigger interval
- 触发间隔:输入每次工作流触发之间的小时数。
¥Hours Between Triggers: Enter the number of hours between each workflow trigger.
- 触发分钟:输入触发节点运行时的分钟数(从
0到59)。
¥Trigger at Minute: Enter the minute past the hour to trigger the node when it runs, from 0 to 59.
例如,如果你输入 6“触发间隔小时数”,30“触发时间(分钟)”,则节点将每六小时运行一次,即每小时的 30 分。
¥For example, if you enter 6 Hours Between Triggers and 30 Trigger at Minute, the node will run every six hours at 30 minutes past the hour.
天触发间隔#
¥Days trigger interval
- 触发间隔天数:输入每次工作流触发之间的天数。
¥Days Between Triggers: Enter the number of days between each workflow trigger.
- 触发小时:选择触发节点的小时。
¥Trigger at Hour: Select the hour of the day to trigger the node.
- 触发分钟:输入触发节点运行时的分钟数(从
0到59)。
¥Trigger at Minute: Enter the minute past the hour to trigger the node when it runs, from 0 to 59.
例如,如果你输入 2“触发间隔天数”,15“触发时间(分钟)”,则节点将每两天上午 9:15 运行一次。
¥For example, if you enter 2 Days Between Triggers, 9am for Trigger at Hour, and 15 Trigger at Minute, the node will run every two days at 9:15am.
触发间隔(周)#
¥Weeks trigger interval
- 周间隔触发器:输入每个工作流触发器之间的周数。
¥Weeks Between Triggers: Enter the number of weeks between each workflow trigger.
- 工作日触发:选择要触发节点的星期几。
¥Trigger on Weekdays: Select the day(s) of the week you want to trigger the node.
- 触发小时:选择触发节点的小时。
¥Trigger at Hour: Select the hour of the day to trigger the node.
- 触发分钟:输入触发节点运行时的分钟数(从
0到59)。
¥Trigger at Minute: Enter the minute past the hour to trigger the node when it runs, from 0 to 59.
例如,如果你输入“2 周触发间隔”、“周一触发”、“下午 3 点触发(每小时)”和“30 分钟触发”,则节点将每两周的周一下午 3:30 运行一次。
¥For example, if you enter 2 Weeks Between Triggers, Monday for Trigger on Weekdays, 3pm for Trigger at Hour, and 30 Trigger at Minute, the node will run every two weeks on Monday at 3:30 PM.
月触发间隔#
¥Months trigger interval
- 触发间隔月数:输入每次工作流触发之间的间隔时间(月数)。
¥Months Between Triggers: Enter the number of months between each workflow trigger.
- 每月特定日期触发:输入触发日期的日期,从
1到31。如果某个月份没有这一天,则该节点不会触发。例如,如果你在此处输入30,则节点在二月份不会触发。
¥Trigger at Day of Month: Enter the day of the month the day should trigger at, from 1 to 31. If a month doesn't have this day, the node won't trigger. For example, if you enter 30 here, the node won't trigger in February.
- 触发小时:选择触发节点的小时。
¥Trigger at Hour: Select the hour of the day to trigger the node.
- 触发分钟:输入触发节点运行时的分钟数(从
0到59)。
¥Trigger at Minute: Enter the minute past the hour to trigger the node when it runs, from 0 to 59.
例如,如果你输入 3“触发间隔月数”,28“触发时间(日)”,0“触发时间(分钟)”,则节点将每季度在每月 28 日上午 9:00 运行一次。
¥For example, if you enter 3 Months Between Triggers, 28 Trigger at Day of Month, 9am for Trigger at Hour, and 0 Trigger at Minute, the node will run each quarter on the 28th day of the month at 9:00 AM.
自定义(Cron)间隔#
¥Custom (Cron) interval
输入自定义 cron 表达式以设置触发器的计划。
¥Enter a custom cron Expression to set the schedule for the trigger.
要生成 Cron 表达式,你可以使用 crontab 专家。将你使用 crontab guru 生成的 Cron 表达式粘贴到 n8n 的“表达式”字段中。
¥To generate a Cron expression, you can use crontab guru. Paste the Cron expression that you generated using crontab guru in the Expression field in n8n.
示例#
¥Examples
| 类型 | 定时任务表达式 | 描述 |
|---|---|---|
| 每隔 X 秒 | */10 * * * * * |
每 10 秒一次。 |
| 每隔 X 分钟 | */5 * * * * |
每 5 分钟一次。 |
| 每小时 | 0 * * * * |
每小时整点。 |
| 每日 | 0 6 * * * |
每天早上 6:00。 |
| 每周 | 0 12 * * 1 |
每周一中午。 |
| 每月 | 0 0 1 * * |
每月 1 日午夜。 |
| 每隔 X 天 | 0 0 */3 * * |
每隔三天午夜。 |
| 仅限工作日 | 0 9 * * 1-5 |
周一至周五早上 9:00。 |
| 自定义小时范围 | 0 9-17 * * * |
每天上午 9:00 到下午 5:00 每小时。 |
| 季度 | 0 0 1 1,4,7,10 * |
每年 1 月、4 月、7 月和 10 月 1 日午夜。 |
Using variables in the Cron expression
虽然可以在计划触发器中使用变量,但它们的值仅在工作流激活时才会计算。如果在工作流激活后更改设置中的变量值,这些更改不会影响 cron 计划。要重新评估变量,请将工作流设置为“非活动”,然后再将其切换回“活动”。
¥While variables can be used in the scheduled trigger, their values only get evaluated when the workflow is activated. If you alter a variable's value in the settings after a workflow is activated, the changes won't alter the cron schedule. To re-evaluate the variable, set the workflow to Inactive and then back to Active again
为什么 Cron 表达式中有六个星号#
¥Why there are six asterisks in the Cron expression
Cron 表达式中的第六个星号表示秒数。此项设置是可选的。即使你未设置秒数,此节点也会执行。
¥The sixth asterisk in the Cron expression represents seconds. Setting this is optional. The node will execute even if you don't set the value for seconds.
| (*) | * | * | * | * | * |
|---|---|---|---|---|---|
| (第二个) | minute | hour | 日期 | month | 星期(周日至周六) |
模板和示例#
¥Templates and examples
常见问题#
¥Common issues
有关常见问题或建议的解决方案,请参阅 常见问题。
¥For common questions or issues and suggested solutions, refer to Common Issues.