定时任务
配置定时任务
yaml
automation:
cron:
enabled: true
timezone: Asia/Shanghai
jobs:
- id: daily-summary
schedule: "0 9 * * *" # 每天早上9点
command: "summarize_day"
enabled: true
- id: weekly-report
schedule: "0 10 * * 1" # 每周一早上10点
command: "generate_weekly_report"
enabled: true定时表达式
| 表达式 | 说明 |
|---|---|
* * * * * | 每分钟 |
0 * * * * | 每小时 |
0 9 * * * | 每天早上9点 |
0 9 * * 1 | 每周一早上9点 |
0 9 1 * * | 每月1号早上9点 |
心跳机制
yaml
automation:
heartbeat:
enabled: true
interval: 300 # 5分钟
endpoint: https://your-webhook.com/heartbeatWebhook 触发
yaml
automation:
webhook:
enabled: true
port: 8080
path: /webhook
secret: ${WEBHOOK_SECRET}bash
# 触发任务
curl -X POST http://localhost:8080/webhook \
-H "Content-Type: application/json" \
-H "X-Secret: your-secret" \
-d '{"task": "daily-summary"}'