Compare commits

..
8 Commits
Author SHA1 Message Date
trnq1ll0 4f0386f488 fix double folder name 2026-03-08 19:47:31 +01:00
trnq1ll0 5f64cdce3f use absolute key folder 2026-03-08 19:45:07 +01:00
trnq1ll0 f93da30d75 fix key file name 2026-03-08 19:40:07 +01:00
trnq1ll0 f66aea6054 use local users ssh key 2026-03-08 19:37:15 +01:00
trnq1ll0 6b0776003d use ssh key file 2026-03-08 19:26:53 +01:00
trnq1ll0 5707598046 remove unused 2026-03-08 19:15:55 +01:00
trnq1ll0 72ac6e3ce6 update config 2026-03-08 19:15:26 +01:00
trnq1ll0 4f3ca893d5 gitignore 2026-03-08 19:15:15 +01:00
4 changed files with 32 additions and 7 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
*.local
.DS_Store
+5 -5
View File
@@ -1,14 +1,14 @@
# Remote rsync source. Example: backup@example.com:/srv/data/project/
RSYNC_SOURCE="boogie@eukelade.uberspace.de:/home/boogie/nextcloud_data/root/files/Obsidian"
# SSH key file used by rsync/ssh
SSH_KEY_FILE="/mnt/bfds-nix/rob/backup/Obsidian-daily-git/.ssh/obsidian-backup"
# Local sync destination (must be a directory inside GIT_REPO_DIR)
RSYNC_TARGET_DIR="/Users/rob/code/obsidian-backup/tests"
# Local monorepo path
GIT_REPO_DIR="/Users/rob/code/obsidian-backup/tests"
RSYNC_TARGET_DIR="/mnt/bfds-nix/rob/backup/Obsidian-daily-git/"
# Prefix for commit message (timestamp is appended automatically)
COMMIT_MESSAGE_PREFIX="backup: rsync sync"
# Optional: custom SSH command for rsync (leave empty if not needed)
# RSYNC_RSH="ssh -i /path/to/key -o StrictHostKeyChecking=yes"
# RSYNC_RSH="ssh -i /path/to/key -o StrictHostKeyChecking=yes"
+7 -1
View File
@@ -8,5 +8,11 @@ RSYNC_TARGET_DIR="/path/to/backup-repo"
# Prefix for commit message (timestamp is appended automatically)
COMMIT_MESSAGE_PREFIX="backup: rsync sync"
# Optional: custom SSH command for rsync (leave empty if not needed)
# SSH key file used by rsync/ssh
SSH_KEY_FILE="/root/.ssh/backup_rsync"
# Optional extra SSH options
# SSH_OPTIONS="-o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
# Optional full custom SSH command for rsync (overrides SSH_KEY_FILE/SSH_OPTIONS)
# RSYNC_RSH="ssh -i /path/to/key -o StrictHostKeyChecking=yes"
+18 -1
View File
@@ -37,6 +37,16 @@ for var in "${required_vars[@]}"; do
fi
done
if [[ -z "${RSYNC_RSH:-}" && -z "${SSH_KEY_FILE:-}" ]]; then
echo "Missing SSH config: set SSH_KEY_FILE or RSYNC_RSH" >&2
exit 1
fi
if [[ -n "${SSH_KEY_FILE:-}" && ! -r "$SSH_KEY_FILE" ]]; then
echo "SSH key file not readable: $SSH_KEY_FILE" >&2
exit 1
fi
mkdir -p "$RSYNC_TARGET_DIR"
repo_abs="$(cd "$RSYNC_TARGET_DIR" && pwd)"
@@ -52,7 +62,14 @@ git_target() {
}
if [[ -n "${RSYNC_RSH:-}" ]]; then
rsync -az --delete -e "$RSYNC_RSH" "$RSYNC_SOURCE" "$repo_abs/"
rsync_rsh="$RSYNC_RSH"
else
ssh_options="${SSH_OPTIONS:--o IdentitiesOnly=yes -o StrictHostKeyChecking=yes}"
rsync_rsh="ssh -i $SSH_KEY_FILE $ssh_options"
fi
if [[ -n "${rsync_rsh:-}" ]]; then
rsync -az --delete -e "$rsync_rsh" "$RSYNC_SOURCE" "$repo_abs/"
else
rsync -az --delete "$RSYNC_SOURCE" "$repo_abs/"
fi