Update: workspace changes

This commit is contained in:
OpenClaw Agent
2026-02-09 18:43:33 +08:00
parent e0a2b323d9
commit 00e55259a7
370 changed files with 1478 additions and 6 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
# OpenClaw Backup Script
# Usage: ./backup.sh [backup_dir]
BACKUP_DIR="${1:-$HOME/openclaw-backups}"
DATE=$(date +%Y-%m-%d_%H%M)
BACKUP_FILE="$BACKUP_DIR/openclaw-$DATE.tar.gz"
mkdir -p "$BACKUP_DIR"
# Create backup (exclude completions cache, logs and temp files)
tar -czf "$BACKUP_FILE" \
--exclude='.openclaw/completions' \
--exclude='.openclaw/*.log' \
--exclude='.openclaw/*.swp' \
--exclude='.openclaw/*.swo' \
--exclude='.openclaw/.openclaw.json.swo' \
-C "$HOME" .openclaw
if [ $? -eq 0 ]; then
SIZE=$(du -h "$BACKUP_FILE" | cut -f1)
# Rotate: keep only last 7 backups
ls -t "$BACKUP_DIR"/openclaw-*.tar.gz 2>/dev/null | tail -n +8 | xargs -r rm
COUNT=$(ls "$BACKUP_DIR"/openclaw-*.tar.gz 2>/dev/null | wc -l)
echo "✅ Backup created: $BACKUP_FILE ($SIZE)"
echo "📁 Total backups: $COUNT"
exit 0
else
echo "❌ Backup failed"
exit 1
fi