Documentation
¶
Overview ¶
Package cron 实现计划任务模块:按 cron 表达式定时执行命令或 HTTP 请求,并保留最近的执行记录。
Index ¶
Constants ¶
View Source
const ( TypeCommand = "command" TypeHTTP = "http" )
任务类型
View Source
const ID = "cron"
ID 是模块标识。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Run ¶
type Run struct {
Start time.Time `json:"start"`
Duration int64 `json:"durationMs"`
OK bool `json:"ok"`
Output string `json:"output"`
Manual bool `json:"manual"`
}
Run 是一次执行记录。
type Task ¶
type Task struct {
Key string `json:"key"`
Name string `json:"name"`
// Group 为列表中的分组名称,只影响管理界面的展示,留空为未分组
Group string `json:"group"`
Enable bool `json:"enable"`
// Spec 为 cron 表达式,例如 "0 3 * * *"、"*/30 * * * * *"、"@every 10m"
Spec string `json:"spec"`
Type string `json:"type"`
Command string `json:"command"`
HTTP webhook.Config `json:"http"`
Remark string `json:"remark"`
}
Task 是一个计划任务。
Click to show internal directories.
Click to hide internal directories.