openclaw-maintain
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese!openclaw daemon status 2>&1 | head -10
!openclaw cron status 2>&1 | head -10
!openclaw daemon status 2>&1 | head -10
!openclaw cron status 2>&1 | head -10
OpenClaw Maintain — Keep It Running
OpenClaw 维护 — 维持系统运行
You are an OpenClaw maintenance operator. Handle daemon lifecycle, updates, log management, cron scheduling, session cleanup, memory indexing, and sandbox management.
你作为OpenClaw维护操作人员,负责处理守护进程生命周期、版本更新、日志管理、Cron调度、会话清理、内存索引以及沙箱管理。
Scope
适用范围
This skill covers operational maintenance — keeping the system running day-to-day:
- Daemon (gateway service) lifecycle
- CLI and gateway updates
- Log rotation and cleanup
- Cron job management
- Session cleanup
- Memory index maintenance
- Sandbox container management
For configuration changes, use .
For diagnostics, use .
For adding new capabilities, use .
openclaw-adminopenclaw-doctoropenclaw-extend本技能覆盖运维维护领域——保障系统日常稳定运行:
- 守护进程(网关服务)生命周期管理
- CLI与网关更新
- 日志轮转与清理
- Cron任务管理
- 会话清理
- 内存索引维护
- 沙箱容器管理
如需进行配置变更,请使用。
如需进行诊断排查,请使用。
如需新增功能,请使用。
openclaw-adminopenclaw-doctoropenclaw-extendDaemon Management
守护进程管理
Status Check
状态检查
bash
openclaw daemon status # service status + gateway probe
openclaw gateway status # gateway-level status
openclaw gateway probe # full reachability checkbash
openclaw daemon status # 服务状态 + 网关探测
openclaw gateway status # 网关级状态
openclaw gateway probe # 完整可达性检查Lifecycle Commands
生命周期命令
bash
openclaw daemon start # start the service
openclaw daemon stop # stop the service
openclaw daemon restart # restart the service
openclaw daemon install # install as system service
openclaw daemon uninstall # remove system servicebash
openclaw daemon start # 启动服务
openclaw daemon stop # 停止服务
openclaw daemon restart # 重启服务
openclaw daemon install # 安装为系统服务
openclaw daemon uninstall # 移除系统服务Troubleshooting
故障排查
Gateway won't start:
bash
openclaw daemon status # check if already running
openclaw gateway status # check port conflicts
openclaw gateway --force # kill existing listener, then startGateway crashes on start:
bash
openclaw logs --limit 50 # check recent logs for errors
openclaw doctor # run health checkPlatform-specific details: See .
references/daemon-reference.md网关无法启动:
bash
openclaw daemon status # 检查是否已在运行
openclaw gateway status # 检查端口冲突
openclaw gateway --force # 终止现有监听进程后启动网关启动时崩溃:
bash
openclaw logs --limit 50 # 查看最近50行日志排查错误
openclaw doctor # 运行健康检查平台特定细节: 参考。
references/daemon-reference.mdUpdates
版本更新
Check for Updates
检查更新
bash
openclaw update status # current vs latest, channel infobash
openclaw update status # 当前版本与最新版本对比、渠道信息Apply Update
应用更新
bash
openclaw update # update (git checkout or npm)
openclaw update --yes # non-interactive
openclaw update --no-restart # update without restarting servicebash
openclaw update # 执行更新(Git切换分支或npm更新)
openclaw update --yes # 非交互式更新
openclaw update --no-restart # 更新后不重启服务Channel Management
渠道管理
bash
openclaw update --channel stable # switch to stable
openclaw update --channel beta # switch to beta
openclaw update --channel dev # switch to dev
openclaw update --tag <version> # one-off versionbash
openclaw update --channel stable # 切换至稳定渠道
openclaw update --channel beta # 切换至测试渠道
openclaw update --channel dev # 切换至开发渠道
openclaw update --tag <version> # 切换至指定版本Post-Update Verification
更新后验证
bash
openclaw daemon status # service running?
openclaw status --all # full health check
openclaw channels status --probe # channels reconnected?bash
openclaw daemon status # 服务是否正常运行?
openclaw status --all # 完整健康检查
openclaw channels status --probe # 渠道是否重新连接?Log Management
日志管理
View Logs
查看日志
bash
openclaw logs # recent gateway logs
openclaw logs --follow # live tail
openclaw logs --limit 100 # last 100 lines
openclaw channels logs # channel-specific logsbash
openclaw logs # 查看最近的网关日志
openclaw logs --follow # 实时追踪日志
openclaw logs --limit 100 # 查看最后100行日志
openclaw channels logs # 查看渠道专属日志Log Rotation / Cleanup
日志轮转/清理
bash
du -sh ~/.openclaw/logs/ # check log size
ls -lah ~/.openclaw/logs/ # list log filesIf error log > 10MB:
bash
undefinedbash
du -sh ~/.openclaw/logs/ # 检查日志占用空间
ls -lah ~/.openclaw/logs/ # 列出日志文件当错误日志超过10MB时:
bash
undefinedRotate the error log
轮转错误日志
mv ~/.openclaw/logs/error.log ~/.openclaw/logs/error.log.$(date +%Y%m%d)
openclaw daemon restart # restart to create fresh log
**Clean old rotated logs:**
```bash
ls -t ~/.openclaw/logs/error.log.* 2>/dev/null | tail -n +4 # keep 3 most recentmv ~/.openclaw/logs/error.log ~/.openclaw/logs/error.log.$(date +%Y%m%d)
openclaw daemon restart # 重启服务以生成新日志文件
**清理旧轮转日志:**
```bash
ls -t ~/.openclaw/logs/error.log.* 2>/dev/null | tail -n +4 # 保留最近3份日志Cron Job Management
Cron任务管理
View Jobs
查看任务
bash
openclaw cron list # all jobs
openclaw cron status # scheduler status
openclaw cron runs # run historybash
openclaw cron list # 查看所有任务
openclaw cron status # 查看调度器状态
openclaw cron runs # 查看任务运行历史Manage Jobs
管理任务
bash
openclaw cron add # add a job (interactive)
openclaw cron edit <name> # edit a job
openclaw cron enable <name> # enable a job
openclaw cron disable <name> # disable a job
openclaw cron rm <name> # remove a job
openclaw cron run <name> # run immediately (debug)Cron expression syntax and job schema: See .
references/cron-reference.mdbash
openclaw cron add # 添加任务(交互式)
openclaw cron edit <name> # 编辑指定任务
openclaw cron enable <name> # 启用指定任务
openclaw cron disable <name> # 禁用指定任务
openclaw cron rm <name> # 删除指定任务
openclaw cron run <name> # 立即运行任务(调试用)Cron表达式语法与任务Schema: 参考。
references/cron-reference.mdSession Management
会话管理
View Sessions
查看会话
bash
openclaw sessions # all sessions
openclaw sessions --active 120 # active in last 2 hours
openclaw sessions --json # machine-readablebash
openclaw sessions # 查看所有会话
openclaw sessions --active 120 # 查看最近2小时内活跃的会话
openclaw sessions --json # 以机器可读格式输出Session Cleanup
会话清理
Old sessions consume disk. Clean periodically:
bash
openclaw sessions # review what exists
openclaw sessions --active 120 # see what's recent旧会话会占用磁盘空间,需定期清理:
bash
openclaw sessions # 查看现有会话
openclaw sessions --active 120 # 查看近期活跃会话Memory Index Maintenance
内存索引维护
Check Index Health
检查索引健康状态
bash
openclaw memory status --deep # full index statusHealthy index: Not dirty, chunk count > 0, file count > 0, agent name matches.
bash
openclaw memory status --deep # 查看完整索引状态健康索引状态: 无脏标记、块数量大于0、文件数量大于0、Agent名称匹配。
Reindex
重新索引
bash
openclaw memory index # rebuild index
openclaw memory status --deep # verify after reindexWhen to reindex:
- After manually adding/removing files from
~/.openclaw/workspace/memory/ - When shows dirty flag
memory status --deep - When search returns stale or missing results
- After agent name change
bash
openclaw memory index # 重建索引
openclaw memory status --deep # 重新索引后验证状态需要重新索引的场景:
- 手动在目录下添加/删除文件后
~/.openclaw/workspace/memory/ - 显示脏标记时
memory status --deep - 搜索返回过期或缺失结果时
- Agent名称变更后
Sandbox Management
沙箱管理
View Containers
查看容器
bash
openclaw sandbox list # all containers
openclaw sandbox list --browser # browser containers only
openclaw sandbox explain # effective sandbox policybash
openclaw sandbox list # 查看所有容器
openclaw sandbox list --browser # 仅查看浏览器容器
openclaw sandbox explain # 查看生效的沙箱策略Recreate Containers
重建容器
bash
openclaw sandbox recreate --all # recreate all
openclaw sandbox recreate --session main # specific session
openclaw sandbox recreate --agent <name> # agent containersWhen to recreate:
- After changing sandbox config
- Container in error state
- After Docker image update
bash
openclaw sandbox recreate --all # 重建所有容器
openclaw sandbox recreate --session main # 重建指定会话的容器
openclaw sandbox recreate --agent <name> # 重建指定Agent的容器需要重建容器的场景:
- 修改沙箱配置后
- 容器处于错误状态时
- Docker镜像更新后
Disk Usage
磁盘使用情况
Check Sizes
检查占用大小
bash
du -sh ~/.openclaw/ # total
du -sh ~/.openclaw/logs/ # logs
du -sh ~/.openclaw/workspace/ # workspace
du -sh ~/.openclaw/state/ # statebash
du -sh ~/.openclaw/ # 总占用
du -sh ~/.openclaw/logs/ # 日志占用
du -sh ~/.openclaw/workspace/ # 工作区占用
du -sh ~/.openclaw/state/ # 状态文件占用Cleanup Targets
可清理目标
| Path | Safe to Clean | How |
|---|---|---|
| Yes (rotated logs) | |
| Yes (config backups) | Keep latest, remove rest |
| Mostly (old state files) | Review before removing |
| 路径 | 是否可安全清理 | 清理方式 |
|---|---|---|
| 是(轮转后的日志) | 使用 |
| 是(配置备份文件) | 保留最新版本,删除其余备份 |
| 大部分可清理(旧状态文件) | 删除前请先检查内容 |
Maintenance Schedules
维护计划
Daily (automated via cron):
- Heartbeat fires (if configured)
- Sessions auto-expire
Weekly:
bash
openclaw doctor # health check
openclaw status --all # overview
openclaw update status # check for updatesMonthly:
bash
openclaw memory status --deep # index health
openclaw memory index # reindex if dirty
du -sh ~/.openclaw/logs/ # log size check
openclaw update # apply updatesAs needed:
bash
openclaw sessions --active 120 # session cleanup
openclaw daemon restart # if issues arise
openclaw sandbox recreate --all # if containers staleFull playbooks: See .
references/maintenance-playbooks.md每日(通过Cron自动执行):
- 发送心跳(若已配置)
- 会话自动过期
每周:
bash
openclaw doctor # 运行健康检查
openclaw status --all # 查看系统概览
openclaw update status # 检查更新每月:
bash
openclaw memory status --deep # 检查索引健康状态
openclaw memory index # 若索引脏则重建
du -sh ~/.openclaw/logs/ # 检查日志占用大小
openclaw update # 应用更新按需执行:
bash
openclaw sessions --active 120 # 清理会话
openclaw daemon restart # 出现问题时重启服务
openclaw sandbox recreate --all # 容器过期时重建完整操作手册: 参考。
references/maintenance-playbooks.mdReferences
参考文档
- — Service paths, platform differences, ports
references/daemon-reference.md - — Job schema, expression syntax, common schedules
references/cron-reference.md - — Step-by-step runbooks
references/maintenance-playbooks.md
- — 服务路径、平台差异、端口信息
references/daemon-reference.md - — 任务Schema、表达式语法、常用调度规则
references/cron-reference.md - — 分步操作指南
references/maintenance-playbooks.md
Related Skills
相关技能
- — Run a health audit to identify maintenance needs
openclaw-doctor - — Apply config changes with verify-apply-verify discipline
openclaw-admin - — Add plugins, channels, nodes, webhooks
openclaw-extend
- — 运行健康审计以识别维护需求
openclaw-doctor - — 遵循验证-应用-验证流程执行配置变更
openclaw-admin - — 添加插件、渠道、节点、Webhook
openclaw-extend