360 Secure SkillHub
360 安全技能中心

Backup

核心功能:备份OpenClaw配置、凭证、工作区等核心数据,自动排除缓存、日志;支持手动备份、通过Cron设置定时备份,自动保留最近7份备份,提供恢复流程。典型场景:用户需创建备份、设置自动备份计划、恢复数据或管理备份时使用。输入为命令行参数或Cron配置,输出为压缩备份文件及执行结果通知。

paudyyin
paudyyin
热度 23.01
最近更新 2026-06-19 10:16:08
分类:自动化依赖:纯提示词应用场景:自动化脚本 / 日程安排

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add 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.