360 Secure SkillHub
360 安全技能中心

OpenClaw Backup

用于备份和恢复 OpenClaw 的配置、凭据、agents 与工作区数据:运行 scripts/backup.sh 生成 tar.gz 归档到 ~/openclaw-backups/,自动保留最近 7 份;可用 OpenClaw cron 配置每日备份;恢复步骤见 references/restore.md,需先停止再启动 openclaw gateway。

alex3alex
alex3alex
热度 99.85
最近更新 2026-05-11 15:54:35
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 工作流 / DevOps / 文件转换 ...

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add openclaw-backup
Metadata
name
openclaw-backup
description
Backup and restore OpenClaw data. Use when user asks to create backups, set up automatic backup schedules, restore from backup, or manage backup rotation. Handles ~/.openclaw directory archiving with proper exclusions.

OpenClaw Backup

Backup and restore OpenClaw configuration, credentials, and workspace.

Create Backup

Run the backup script:

./scripts/backup.sh [backup_dir]

Default backup location: ~/openclaw-backups/

Output: openclaw-YYYY-MM-DD_HHMM.tar.gz

What Gets Backed Up

  • openclaw.json — main config
  • credentials/ — API keys, tokens
  • agents/ — agent configs, auth profiles
  • workspace/ — memory, SOUL.md, user files
  • telegram/ — session data
  • cron/ — scheduled tasks

Excluded

  • completions/ — cache, regenerated automatically
  • *.log — logs

Setup Daily Backup with Cron

Use OpenClaw cron for daily backups with notification:

{
  "name": "daily-backup",
  "schedule": {"kind": "cron", "expr": "0 3 * * *", "tz": "UTC"},
  "payload": {
    "kind": "agentTurn",
    "message": "Run ~/.openclaw/backup.sh and report result to user."
  },
  "sessionTarget": "isolated",
  "delivery": {"mode": "announce"}
}

Restore

See references/restore.md for step-by-step restore instructions.

Quick restore:

openclaw gateway stop
mv ~/.openclaw ~/.openclaw-old
tar -xzf ~/openclaw-backups/openclaw-YYYY-MM-DD_HHMM.tar.gz -C ~
openclaw gateway start

Rotation

Script keeps last 7 backups automatically.