From f8f391201dc7d874fd8c0d4705c6bbf2adaaf8ec Mon Sep 17 00:00:00 2001 From: root Date: Sun, 24 May 2026 15:28:00 +0000 Subject: [PATCH] add: backup snapshot script, update README with correct clone URL --- .gitignore | 5 ++++- README.md | 2 +- scripts/snapshot_hermes_db.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 scripts/snapshot_hermes_db.sh diff --git a/.gitignore b/.gitignore index d5a68d0..fb6bac8 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,7 @@ interrupt_debug.log models_dev_cache.json # Backup files -*.bak.* \ No newline at end of file +*.bak.* + +# Git credentials +.git-credentials \ No newline at end of file diff --git a/README.md b/README.md index e69a7cc..39377f7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scri # 2. Clone this repo over the top cd ~/.hermes git init -git remote add origin http://192.168.68.145:3000/andy/hermes-config.git +git remote add origin https://gitea.conlon.fun/andy/hermes-config.git git pull origin main # 3. Restore secrets (from your safe backup) diff --git a/scripts/snapshot_hermes_db.sh b/scripts/snapshot_hermes_db.sh new file mode 100755 index 0000000..c6d91dd --- /dev/null +++ b/scripts/snapshot_hermes_db.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Daily snapshot of Hermes SQLite databases for disaster recovery +# Copies memory_store.db and state.db to ~/.hermes/backups/ with timestamps +# Manages retention: keeps last 30 days + +HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}" +BACKUP_DIR="$HERMES_HOME/backups" +RETENTION_DAYS=30 + +mkdir -p "$BACKUP_DIR" + +DATE=$(date +%Y%m%d_%H%M%S) + +for db in memory_store.db state.db; do + SRC="$HERMES_HOME/$db" + if [ -f "$SRC" ]; then + cp "$SRC" "$BACKUP_DIR/${db%.db}_${DATE}.db" + echo "backed up $db" + else + echo "skipping $db (not found)" + fi +done + +# Prune backups older than RETENTION_DAYS +find "$BACKUP_DIR" -name '*.db' -type f -mtime +$RETENTION_DAYS -delete 2>/dev/null + +echo "snapshot complete: $(date)" \ No newline at end of file