Skip to content

调度触发器节点(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.

你必须发布工作流程

如果工作流使用计划节点作为触发器,请确保保存并发布该工作流。

Timezone settings

The node relies on the timezone setting. n8n uses either:

  1. The workflow timezone, if set. Refer to Workflow settings for more information.
  2. The n8n instance timezone, if the workflow timezone isn't set. The default is America/New York for 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 秒运行一次。

分钟触发间隔(Minutes trigger interval)#

  • 触发间隔分钟数:输入每次工作流触发之间的分钟数。例如,如果你在这里输入 5,触发器将每 5 分钟运行一次。

小时触发间隔(Hours trigger interval)#

  • 触发间隔小时数:输入每次工作流触发之间的小时数。
  • 分钟触发:输入小时后的分钟,当节点运行时在该分钟触发,从 059

例如,如果你输入 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)#

  • 触发间隔天数:输入每次工作流触发之间的天数。
  • 触发时间(小时):选择触发节点的具体小时。
  • 分钟触发:输入小时后的分钟,当节点运行时在该分钟触发,从 059

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)#

  • 触发间隔周数:输入每次工作流触发之间的周数。
  • 在工作日触发:选择你希望触发节点的星期几。
  • 触发时间(小时):选择触发节点的具体小时。
  • 分钟触发:输入小时后的分钟,当节点运行时在该分钟触发,从 059

例如,如果你在“触发器之间的周数”中输入 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)#

  • 触发间隔月数:输入每次工作流触发之间的月数。
  • 按月份的日期触发:输入希望触发的月份中的日期,从 131。如果某个月没有这个日期,该节点将不会触发。例如,如果你在这里输入 30,节点在二月将不会触发。
  • 触发时间(小时):选择触发节点的具体小时。
  • 分钟触发:输入小时后的分钟,当节点运行时在该分钟触发,从 059

例如,如果你输入 3 触发间隔(月)28 在每月的某一天触发上午9点 作为 触发小时,以及 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 guru。将你使用 crontab guru 生成的 Cron 表达式粘贴到 n8n 中的 Expression 字段。

🌐 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)#

Type Cron Expression Description
Every X Seconds */10 * * * * * Every 10 seconds.
Every X Minutes */5 * * * * Every 5 minutes.
Hourly 0 * * * * Every hour on the hour.
Daily 0 6 * * * At 6:00 AM every day.
Weekly 0 12 * * 1 At noon every Monday.
Monthly 0 0 1 * * At midnight on the 1st of every month.
Every X Days 0 0 */3 * * At midnight every 3rd day.
Only Weekdays 0 9 * * 1-5 At 9:00 AM Monday through Friday.
Custom Hourly Range 0 9-17 * * * Every hour from 9:00 AM to 5:00 PM every day.
Quarterly 0 0 1 1,4,7,10 * At midnight on the 1st of January, April, July, and October.

Using variables in the Cron expression

While variables can be used in the scheduled trigger, their values only get evaluated when the workflow is published. If you alter a variable's value in the settings after a workflow is published, the changes won't alter the cron schedule. To re-evaluate the variable, unpublish the workflow and then re-publish it.

为什么 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.

(*) * * * * *
(秒) 分钟 小时 月份中的天 月份 星期几(周日-周六)

模板和示例(Templates and examples)#

Template widget placeholder.

常见问题(Common issues)#

有关常见问题或问题及建议的解决方案,请参阅 常见问题

🌐 For common questions or issues and suggested solutions, refer to Common Issues.