Appearance
openclaw cron
管理 Gateway 调度器的定时任务(cron jobs)。
相关文档:
- Cron jobs:Cron jobs
运行
openclaw cron --help查看完整命令列表。
重要说明
- 独立的
cron add任务默认启用--announce投递。使用--no-deliver可将输出保留在内部不发送。--deliver作为--announce的废弃别名仍然支持。 - 一次性任务(
--at)成功执行后默认自动删除。使用--keep-after-run可保留。 - 对于一次性 CLI 任务,没有时区偏移的
--at时间视为 UTC,除非同时传入--tz <iana>将其解释为指定时区的本地挂钟时间。 - 周期性任务在连续出错后会使用指数退避重试(30s → 1m → 5m → 15m → 60m),下次成功运行后恢复正常调度。
openclaw cron run现在在手动运行入队后立即返回。成功响应包含{ ok: true, enqueued: true, runId },使用openclaw cron runs --id <job-id>跟踪最终结果。- 日志保留/清理由配置控制:
cron.sessionRetention(默认24h):清理已完成的独立运行 session。cron.runLog.maxBytes+cron.runLog.keepLines:清理~/.openclaw/cron/runs/<jobId>.jsonl。
升级提示:如果你有旧版 cron 任务(早于当前投递/存储格式),请运行 openclaw doctor --fix。Doctor 会规范化遗留 cron 字段(jobId、schedule.cron、顶层投递字段、payload provider 投递别名),并将简单的 notify: true webhook 回退任务迁移到显式 webhook 投递(当 cron.webhook 已配置时)。
常见编辑操作
更新投递设置而不修改消息内容:
bash
openclaw cron edit <job-id> --announce --channel telegram --to "123456789"禁用独立任务的投递:
bash
openclaw cron edit <job-id> --no-deliver为独立任务启用轻量引导上下文:
bash
openclaw cron edit <job-id> --light-context向指定频道发布通知:
bash
openclaw cron edit <job-id> --announce --channel slack --to "channel:C1234567890"创建带轻量引导上下文的独立任务——让你的龙虾每天早上自动汇报:
bash
openclaw cron add \
--name "Lightweight morning brief" \
--cron "0 7 * * *" \
--session isolated \
--message "Summarize overnight updates." \
--light-context \
--no-deliver--light-context 仅适用于独立 agent-turn 任务。在轻量模式下,cron 运行时的引导上下文会保持为空,而不是注入完整的工作区引导集。