diff --git a/scripts/backup-apps.sh b/scripts/backup-apps.sh index 04a9913..36b8bd7 100755 --- a/scripts/backup-apps.sh +++ b/scripts/backup-apps.sh @@ -12,12 +12,25 @@ echo "[$(date)] Backup Apps started" rm -rf "$BACKUP_DIR" mkdir -p "$BACKUP_DIR" -# Backup important apps configs -tar -czf "$BACKUP_DIR/apps-configs-$DATE.tar.gz" \ - /root/Apps/Camila \ - /root/Apps/RAG \ - /root/Apps/VOXDO \ - 2>/dev/null || true +# Loop over all directories in /root/Apps/ +cd /root/Apps +for APP_DIR in */; do + # Remove trailing slash + APP_NAME=${APP_DIR%/} + + # Skip if it's not a directory or if it is the backup-ui/BrainKP itself (to prevent recursion/lock if needed, though they are fine) + [ -d "$APP_NAME" ] || continue + + echo "Backing up app: $APP_NAME" + + # Compress each app into its own tar.gz file, excluding heavy unnecessary folders + tar -czf "$BACKUP_DIR/${APP_NAME}-$DATE.tar.gz" \ + --exclude="node_modules" \ + --exclude="venv" \ + --exclude=".venv" \ + --exclude="__pycache__" \ + "$APP_NAME" 2>/dev/null || true +done # Sync to Google Drive rclone copy "$BACKUP_DIR" "$DEST" --progress