OpenClaw Auto Update
Keeps OpenClaw and installed ClawHub skills up to date automatically.
Prerequisites
- -
openclaw CLI — required for openclaw update, openclaw gateway restart, and notifications - INLINECODE3 CLI — required for
clawhub list, clawhub inspect, and INLINECODE6 - INLINECODE7 — required for loading INLINECODE8
- INLINECODE9 4+ — required by the shell scripts for associative arrays and other modern Bash features
Quick Start
1. Install cron job (runs daily at 2 AM by default)
CODEBLOCK0
2. Run manually now
CODEBLOCK1
3. Preview what would be updated (no changes)
CODEBLOCK2
Configuration
Create ~/.openclaw/workspace/skills/openclaw-auto-update/config.json:
CODEBLOCK3
See references/config-schema.md for all options and examples.
What It Does
- 1. Loads JSON config — reads
config.json with python3 and merges defaults - Updates OpenClaw — runs
openclaw update --yes --no-restart; in preview mode it logs the equivalent openclaw update --dry-run --yes --no-restart command without making changes - Finds installed skills — enumerates skills via
clawhub list, with workspace directory fallback - Checks release channel — uses
clawhub inspect <slug> to skip pre-releases when INLINECODE18 - Updates skills — runs
clawhub update <slug> --no-input for each eligible installed skill; in preview mode it only logs clawhub update --all because the installed clawhub CLI does not support update dry runs - Protects local changes — skips skills with uncommitted git changes
- Respects skip list — never touches skills in INLINECODE22
- Restarts gateway — only if OpenClaw version actually changed
- Notifies — sends
openclaw message send --target <target> -m <message> when notifyTarget is set, otherwise INLINECODE25
Change Schedule
CODEBLOCK4
Logs
CODEBLOCK5
Skip a Specific Skill Permanently
Add to config.json:
CODEBLOCK6
技能名称: ayao-updater
详细描述:
OpenClaw 自动更新
自动保持 OpenClaw 及已安装的 ClawHub 技能为最新版本。
前置条件
- - openclaw 命令行工具 — 用于执行 openclaw update、openclaw gateway restart 及通知功能
- clawhub 命令行工具 — 用于执行 clawhub list、clawhub inspect 及 clawhub update
- python3 — 用于加载 config.json 配置文件
- bash 4+ 版本 — shell 脚本需要关联数组及其他现代 Bash 特性
快速开始
1. 安装定时任务(默认每天凌晨2点运行)
bash
bash ~/.openclaw/workspace/skills/openclaw-auto-update/scripts/install-cron.sh
2. 立即手动运行
bash
bash ~/.openclaw/workspace/skills/openclaw-auto-update/scripts/update.sh
3. 预览将要更新的内容(不执行实际更改)
bash
bash ~/.openclaw/workspace/skills/openclaw-auto-update/scripts/update.sh --dry-run
配置说明
创建 ~/.openclaw/workspace/skills/openclaw-auto-update/config.json 文件:
json
{
schedule: 0 2 *,
skipSkills: [],
skipPreRelease: true,
restartGateway: true,
notify: true,
notifyTarget: null
}
所有选项及示例请参阅 references/config-schema.md。
功能说明
- 1. 加载 JSON 配置 — 使用 python3 读取 config.json 并合并默认值
- 更新 OpenClaw — 执行 openclaw update --yes --no-restart;预览模式下仅记录等效的 openclaw update --dry-run --yes --no-restart 命令而不实际更改
- 查找已安装技能 — 通过 clawhub list 枚举技能,并支持工作区目录作为备选
- 检查发布渠道 — 使用 clawhub inspect 在 skipPreRelease: true 时跳过预发布版本
- 更新技能 — 对每个符合条件的已安装技能执行 clawhub update --no-input;预览模式下仅记录 clawhub update --all,因为当前安装的 clawhub 命令行工具不支持更新预览
- 保护本地更改 — 跳过存在未提交 git 更改的技能
- 遵循跳过列表 — 绝不触碰 skipSkills 中列出的技能
- 重启网关 — 仅在 OpenClaw 版本实际发生变更时执行
- 发送通知 — 当设置了 notifyTarget 时执行 openclaw message send --target -m ,否则执行 openclaw system event --text --mode now
更改计划任务
bash
改为每周日凌晨3点执行
bash ~/.openclaw/workspace/skills/openclaw-auto-update/scripts/install-cron.sh --schedule 0 3
0
卸载定时任务
bash ~/.openclaw/workspace/skills/openclaw-auto-update/scripts/install-cron.sh --uninstall
日志查看
bash
tail -f /tmp/openclaw-auto-update.log
永久跳过特定技能
在 config.json 中添加:
json
{ skipSkills: [my-custom-skill, work-internal] }