openclaw-backup-guide
by @lancelot3777-svg
Automates hourly OpenClaw workspace backups with SQLite database export, optional NAS sync via rsync, and GitHub version control commits and pushes.
clawhub install openclaw-backup-guideπ About This Skill
Backup Automation Skill
Automated backup system for OpenClaw workspaces with database, NAS, and GitHub integration.
What It Does
This skill provides automated hourly backups:
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 remote -vUsage
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 -1Check database backup
ls -lh workspace.db*Check NAS sync
ls -lh /your/nas/path/
Files
backup-db.js - Node.js script for database backupbackup-nas.sh - Bash script for NAS rsyncskill.json - Skill metadataSKILL.md - This file (usage guide)README.md - OverviewRequirements
Customization
Change Backup Frequency
Edit the cron schedule:
0 * * * **/30 * * * *0 */6 * * *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:
tail -f /var/log/cronchmod +x backup-nas.shGit push fails:
ssh -T git@github.comgit remote -vNAS sync issues:
rsync -av /source /destinationmount | grep nasSecurity Notes
License
MIT - Use freely, modify as needed.
Author
Created by Lance (lancelot3777) for OpenClaw workspace management.
π‘ Examples
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 -1Check database backup
ls -lh workspace.db*Check NAS sync
ls -lh /your/nas/path/
βοΈ Configuration
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 remote -vπ Tips & Best Practices
Backup not running:
tail -f /var/log/cronchmod +x backup-nas.shGit push fails:
ssh -T git@github.comgit remote -vNAS sync issues:
rsync -av /source /destinationmount | grep nas