← 返回
数据分析 中文

openclaw-backup-guide

Automates hourly OpenClaw workspace backups with SQLite database export, optional NAS sync via rsync, and GitHub version control commits and pushes.
每小时自动备份 OpenClaw 工作区,包括 SQLite 数据库导出、可选 rsync NAS 同步和 GitHub 版本控制提交推送。
lancelot3777-svg
数据分析 clawhub v1.0.0 1 版本 99884.8 Key: 无需
★ 0
Stars
📥 867
下载
💾 12
安装
1
版本
#latest

概述

Backup Automation Skill

Automated backup system for OpenClaw workspaces with database, NAS, and GitHub integration.

What It Does

This skill provides automated hourly backups:

  • Database backup to SQLite
  • NAS sync via rsync
  • Git commit + push to GitHub for version control

Perfect for maintaining workspace continuity and disaster recovery.

Setup

1. Configure NAS Target (Optional)

Edit backup-nas.sh to set your NAS mount point:

NAS_PATH="/path/to/your/nas/backup"

If you don't use NAS, the script will skip that step gracefully.

2. Set Up Cron Job

Add to your crontab for hourly backups:

0 * * * * cd /path/to/workspace && node scripts/backup-db.js; bash scripts/backup-nas.sh; git add -A && git commit -m "Hourly backup: $(date '+%Y-%m-%d %H:%M %Z')" && git push origin main

OR use OpenClaw's built-in cron:

openclaw cron add --schedule "0 * * * *" --task "Hourly workspace backup" --command "cd /path/to/workspace && node scripts/backup-db.js && bash scripts/backup-nas.sh && git add -A && git commit -m 'Auto backup' && git push"

3. GitHub Authentication

Ensure you have:

  • Git configured with your credentials
  • GitHub SSH key added (or HTTPS token set)
  • Remote origin configured: git remote -v

Usage

Manual Backup

cd /path/to/your/workspace
node backup-db.js
bash backup-nas.sh
git add -A && git commit -m "Manual backup" && git push

Check Backup Status

# Check last backup commit
git log --oneline -1

# Check database backup
ls -lh workspace.db*

# Check NAS sync
ls -lh /your/nas/path/

Files

  • backup-db.js - Node.js script for database backup
  • backup-nas.sh - Bash script for NAS rsync
  • skill.json - Skill metadata
  • SKILL.md - This file (usage guide)
  • README.md - Overview

Requirements

  • Node.js 18+ (for backup-db.js)
  • Git (for version control)
  • rsync (for NAS sync, optional)
  • GitHub repository (for remote storage)

Customization

Change Backup Frequency

Edit the cron schedule:

  • Every hour: 0
  • Every 30 min: /30 *
  • Every 6 hours: 0 /6
  • Daily at 3am: 0 3 *

Add Custom Backup Logic

Extend backup-db.js with additional backup targets:

// Add S3 sync, Dropbox upload, etc.

Backup Retention

To limit backup history in Git:

# Squash old commits periodically
git rebase -i HEAD~100

Troubleshooting

Backup not running:

  • Check cron logs: tail -f /var/log/cron
  • Verify script permissions: chmod +x backup-nas.sh

Git push fails:

  • Verify SSH key: ssh -T git@github.com
  • Check remote: git remote -v

NAS sync issues:

  • Test rsync manually: rsync -av /source /destination
  • Check mount: mount | grep nas

Security Notes

  • Database backups may contain sensitive data
  • Ensure your GitHub repo is private if storing sensitive info
  • NAS should be on a secure network (Tailscale/VPN recommended)
  • Consider encryption for sensitive backups

License

MIT - Use freely, modify as needed.

Author

Created by Lance (lancelot3777) for OpenClaw workspace management.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 16:57 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,797
data-analysis

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 270 📥 57,025
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 166 📥 60,213