Compare commits

..

No commits in common. "78194ec94e90547e54389ceaad702682d45997d7" and "0339398fc1d42410db035724a3c8c673ad8f0a56" have entirely different histories.

4 changed files with 12 additions and 21 deletions

View File

@ -29,8 +29,7 @@ borgBackupAppToLocation()
local loc_name local loc_name
loc_name=$(resticLocationName "$idx") loc_name=$(resticLocationName "$idx")
# Logs to stderr; stdout is only the archive name for the caller's $(). isNotice "Snapshotting $app_name$loc_name (archive: $archive)"
isNotice "Snapshotting $app_name$loc_name (archive: $archive)" >&2
sudo -E -u "$docker_install_user" borg create \ sudo -E -u "$docker_install_user" borg create \
--comment "$comment" \ --comment "$comment" \
@ -41,10 +40,10 @@ borgBackupAppToLocation()
local rc=$? local rc=$?
if [[ $rc -eq 0 ]]; then if [[ $rc -eq 0 ]]; then
isSuccessful "Backup created in $loc_name: $archive" >&2 isSuccessful "Backup created in $loc_name: $archive"
echo "$archive" echo "$archive"
else else
isError "Backup to $loc_name failed for $app_name" >&2 isError "Backup to $loc_name failed for $app_name"
fi fi
borgEnvUnset borgEnvUnset

View File

@ -20,7 +20,7 @@ kopiaBackupAppToLocation()
local loc_name local loc_name
loc_name=$(resticLocationName "$idx") loc_name=$(resticLocationName "$idx")
isNotice "Snapshotting $app_name$loc_name (kopia)" >&2 isNotice "Snapshotting $app_name$loc_name (kopia)"
# Kopia has no per-run --exclude; it reads .kopiaignore from the source # Kopia has no per-run --exclude; it reads .kopiaignore from the source
# tree. On the live path write the raw DB data dirs (made relative to the # tree. On the live path write the raw DB data dirs (made relative to the
@ -50,11 +50,11 @@ kopiaBackupAppToLocation()
snapshot_id=$(echo "$output" | grep -oE '"id":\s*"[^"]+"' | head -1 | cut -d'"' -f4) snapshot_id=$(echo "$output" | grep -oE '"id":\s*"[^"]+"' | head -1 | cut -d'"' -f4)
if [[ $rc -eq 0 ]]; then if [[ $rc -eq 0 ]]; then
isSuccessful "Backup created in $loc_name: ${snapshot_id:0:12}" >&2 isSuccessful "Backup created in $loc_name: ${snapshot_id:0:12}"
echo "$snapshot_id" echo "$snapshot_id"
else else
isError "Kopia backup to $loc_name failed for $app_name" >&2 isError "Kopia backup to $loc_name failed for $app_name"
echo "$output" | tail -10 >&2 echo "$output" | tail -10
fi fi
kopiaEnvUnset kopiaEnvUnset

View File

@ -32,9 +32,7 @@ resticBackupAppToLocation()
local loc_name local loc_name
loc_name=$(resticLocationName "$idx") loc_name=$(resticLocationName "$idx")
# Logs go to stderr so this function's stdout is ONLY the snapshot id — isNotice "Snapshotting $app_name$loc_name"
# the caller captures it with $() and feeds it to verify/retention.
isNotice "Snapshotting $app_name$loc_name" >&2
local output local output
output=$(sudo -E -u "$docker_install_user" restic backup \ output=$(sudo -E -u "$docker_install_user" restic backup \
--host "$host_tag" \ --host "$host_tag" \
@ -49,11 +47,11 @@ resticBackupAppToLocation()
snapshot_id=$(echo "$output" | grep -o '"snapshot_id":"[^"]*"' | tail -1 | cut -d'"' -f4) snapshot_id=$(echo "$output" | grep -o '"snapshot_id":"[^"]*"' | tail -1 | cut -d'"' -f4)
if [[ $rc -eq 0 ]]; then if [[ $rc -eq 0 ]]; then
isSuccessful "Backup created in $loc_name: ${snapshot_id:0:8}" >&2 isSuccessful "Backup created in $loc_name: ${snapshot_id:0:8}"
echo "$snapshot_id" echo "$snapshot_id"
else else
isError "Backup to $loc_name failed for $app_name" >&2 isError "Backup to $loc_name failed for $app_name"
echo "$output" | tail -10 >&2 echo "$output" | tail -10
fi fi
resticEnvUnset resticEnvUnset

View File

@ -9,7 +9,7 @@
cliAppRestore() { cliAppRestore() {
local app_name="$1" local app_name="$1"
local snapshot="$2" local snapshot="${2:-latest}"
local repo="$3" local repo="$3"
if [[ -z "$app_name" ]]; then if [[ -z "$app_name" ]]; then
@ -18,11 +18,5 @@ cliAppRestore() {
return 1 return 1
fi fi
# Normalise the snapshot selector: unset args arrive as the literal
# "empty" from the CLI wrapper, and the help advertises --latest, but
# restorePickSnapshot expects the bare token "latest".
[[ -z "$snapshot" || "$snapshot" == "empty" || "$snapshot" == "--latest" ]] && snapshot="latest"
[[ -z "$repo" || "$repo" == "empty" ]] && repo=""
restoreAppStart "$app_name" "$snapshot" "$repo" restoreAppStart "$app_name" "$snapshot" "$repo"
} }