您可以通过在
heartbeat.yml
文件中添加以下 cron 表达式来实现此目的 -
- type: http
id: myhost
name: My HTTP Host
schedule: '* */1 20-21 * * * *'
hosts: ["http://myhost:80"]
计划选项使用基于此 cronexpr 实现的类似 cron 的语法。
此实现的参考文档位于 https://en.wikipedia.org/wiki/Cron#CRON_expression,我将其复制/粘贴到此处(懒惰!),并在与此实现不同的地方进行了修改:
Field name Mandatory? Allowed values Allowed special characters
---------- ---------- -------------- --------------------------
Seconds No 0-59 * / , -
Minutes Yes 0-59 * / , -
Hours Yes 0-23 * / , -
Day of month Yes 1-31 * / , - L W
Month Yes 1-12 or JAN-DEC * / , -
Day of week Yes 0-6 or SUN-SAT * / , - L #
Year No 1970–2099 * / , -