返回顶部
c

continuous-openclaw-config-guard配置回滚卫士

OpenClaw configuration rollback guardian with automatic backup and recovery. Monitors openclaw.json for changes, creates backups before modifications, restarts the gateway, and automatically rolls back if no message activity is detected within a configurable timeout (default 5 minutes). Provides safety net for risky configuration changes, gateway configuration testing, or any edits to openclaw.json that might break the system. Use when: (1) Editing openclaw.json and want automatic rollback prote

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
256
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

continuous-openclaw-config-guard

OpenClaw 配置回滚守护

适用且测试过linux系统。

功能

  1. 1. 监控配置文件 - 持续监控 ~/.openclaw/openclaw.json
  2. 自动备份 - 配置修改前自动创建备份
  3. 自动重启网关 - 配置修改后自动重启网关
  4. 消息验证 - 一段时间内未收到消息则自动回滚
  5. 自动恢复 - 回滚后自动重启网关

文件结构

~/.openclaw/workspace/skills/continuous-openclaw-config-guard/
├── scripts/
├── guard.sh # 守护脚本(核心)
└── continuous-openclaw-config-guard.service.txt # systemd 服务文件
├── SKILL.md # 本说明文件
├── guard.log # 运行日志
├── guard.pid # 进程ID文件
└── backups/ # 备份目录
├── openclaw.json.20250310160000
├── openclaw.json.20250310160500
└── openclaw.json.rollback.20250310161000

环境变量

可以通过环境变量自定义配置。

必须修改的变量

变量默认值说明为什么需要修改
SESSION_FILE~/.openclaw/agents/huoxiaoxing/sessions/sessions.json会话文件路径必须修改! 默认值中的 huoxiaoxing 是开发者的 agent 名称,其他用户需要改成自己的 agent 名称才能正确检测消息活动

通常不需要修改的变量

如果你的 OpenClaw 安装路径或者agent的工作空间不同,需要修改以下变量。

变量默认值说明
CONFIGFILE~/.openclaw/openclaw.json要监控的配置文件
BACKUPDIR
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/backups | 备份存放目录 |
| LOG_FILE | ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/guard.log | 日志文件路径 |
| PID_FILE | ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/guard.pid | PID文件路径 |
| OPENCLAW_BIN | ~/.npm-global/bin/openclaw | OpenClaw 可执行文件 |
| WAIT_TIME | 300 | 等待验证时间(秒) |
| CHECK_INTERVAL | 10 | 检查间隔(秒) |

使用环境变量示例

bash

修改 SESSION_FILE(必须!)


SESSION_FILE=~/.openclaw/agents/your-agent-name/sessions/sessions.json ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

监控不同的配置文件

CONFIG_FILE=/path/to/custom.json ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

自定义等待时间(600秒=10分钟)

WAIT_TIME=600 ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

修改 OpenClaw 命令路径(如果安装位置不同)

OPENCLAW_BIN=/path/to/your/openclaw.bash ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

组合使用

SESSIONFILE=~/.openclaw/agents/your-agent/sessions/sessions.json WAITTIME=600 ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

使用方法

方式一:systemd 服务(推荐)

作为系统服务运行,开机自启,崩溃自动重启。systemd 只管理守护进程的启动/停止,其他操作(回滚、列备份等)直接用手动命令。

修改服务文件

使用前必须修改 continuous-openclaw-config-guard.service.txt 中的以下内容:

  1. 1. ExecStart/ExecStop 路径 - 改为你的实际安装路径
  2. User - 改为你的用户名
  3. WorkingDirectory - 改为你的实际安装路径
  4. 环境变量 - 特别是 SESSION_FILE 中的 agent 名称

ini
[Service]
ExecStart=/你的/实际/路径/scripts/guard.sh -s
ExecStop=/你的/实际/路径/scripts/guard.sh -k
User=你的用户名
WorkingDirectory=/你的/实际/路径
Environment=SESSION_FILE=/home/你的用户名/.openclaw/agents/你的agent名/sessions/sessions.json

安装服务

bash

1.添加脚本执行权限


chmod +x ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh

2. 先编辑服务文件,修改上述内容

nano ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/continuous-openclaw-config-guard.service.txt

3. 复制服务文件到 systemd 目录

sudo cp ~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/continuous-openclaw-config-guard.service.txt /etc/systemd/system/continuous-openclaw-config-guard.service

4. 重新加载 systemd

sudo systemctl daemon-reload

5. 启动服务

sudo systemctl start continuous-openclaw-config-guard

6. 查看状态

sudo systemctl status continuous-openclaw-config-guard

7. 开机自启(可选)

sudo systemctl enable continuous-openclaw-config-guard

管理服务(仅启动/停止/重启)

bash

启动守护进程


sudo systemctl start continuous-openclaw-config-guard

停止守护进程

sudo systemctl stop continuous-openclaw-config-guard

重启守护进程

sudo systemctl restart continuous-openclaw-config-guard

查看日志

sudo journalctl -u continuous-openclaw-config-guard -f

查看所有日志

sudo journalctl -u continuous-openclaw-config-guard

其他操作(直接用手动命令)

即使使用 systemd,以下命令仍然可以直接使用:

bash

立即回滚到最新备份并重启网关


~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -r

列出所有备份(带备注)

~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -l

查看帮助

~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -h

方式二:手动运行

适合临时测试或不使用 systemd 的系统。所有操作都通过脚本命令完成。

启动守护(后台运行)

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s

启动守护,自定义等待时间(10分钟)

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -s -w 600

停止守护

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -k

立即回滚到最新备份并重启网关

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -r

列出所有备份(带备注)

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -l

查看帮助

bash
~/.openclaw/workspace/skills/continuous-openclaw-config-guard/scripts/guard.sh -h

完整工作流程

  1. 1. 守护进程启动
  1. 2. 创建初始备份(若无备份)
  1. 3. 持续监控 openclaw.json 修改时间
↓ 检测到修改
  1. 4. 重启网关
↓ ┌──────┴──────┐ │ 重启成功? │ ├──────┬──────┤ │ 是 │ 否 │ ↓ ↓ │
  1. 5. 开始计时

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 continuous-openclaw-config-guard-1776117614 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 continuous-openclaw-config-guard-1776117614 技能

通过命令行安装

skillhub install continuous-openclaw-config-guard-1776117614

下载

⬇ 下载 continuous-openclaw-config-guard v1.0.1(免费)

文件大小: 7.93 KB | 发布时间: 2026-4-15 12:19

v1.0.1 最新 2026-4-15 12:19
- No code or documentation changes in this release.
- Version bumped to 1.0.1 with no changes detected.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部