简介
备份和恢复 OpenClaw 数据。用于创建备份、设置自动备份计划、从备份恢复或管理备份轮换。
功能
- 备份 OpenClaw 数据
- 设置自动备份计划
- 从备份恢复数据
- 管理备份轮换
- 处理
~/.openclaw 目录的归档,带有适当的排除设置。
# 原始 YAML frontmatter 保留(示例,实际根据提供的 SKILL.md 内容保留)
# 保留原始 YAML 部分,不进行翻译
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.