From e9f0cbb03dbc390b53843ab1ff23d354483abe46 Mon Sep 17 00:00:00 2001 From: Matt Speer Date: Sun, 1 Feb 2026 22:48:01 -0600 Subject: [PATCH] Modified the photos notifications and logging to be more clear. --- airgap_backup.sh | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/airgap_backup.sh b/airgap_backup.sh index 23e9343..e64f32d 100644 --- a/airgap_backup.sh +++ b/airgap_backup.sh @@ -144,28 +144,28 @@ fi # ============================================================================== # Subtask 3.1: Sync most recent file in photos/backups directory # ============================================================================== -echo "Starting rsync of the most recent file in '$PHOTOS_BACKUP_SOURCE' to '$PHOTOS_DESTINATION'..." +echo "Starting rsync of the most recent database backup file in '$PHOTOS_BACKUP_SOURCE' to '$PHOTOS_DESTINATION'..." if [ ! -d "$PHOTOS_BACKUP_SOURCE" ]; then - echo "Error: Photos source directory '$PHOTOS_BACKUP_SOURCE' not found." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. Photos source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: Immich database backup source directory '$PHOTOS_BACKUP_SOURCE' not found." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. No database backup directory found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else # Find the most recent file in the directory. LATEST_BACKUP_FILE=$(ls -t "$PHOTOS_BACKUP_SOURCE" | head -n 1) # Check if a file was found. if [ -z "$LATEST_BACKUP_FILE" ]; then - echo "Error: No files found in Photos backup directory '$PHOTOS_BACKUP_SOURCE'." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: No files found in Photos backup directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: No files found in Immich database backup directory '$PHOTOS_BACKUP_SOURCE'." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: No database backup files found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else FULL_BACKUP_PATH="$PHOTOS_BACKUP_SOURCE/$LATEST_BACKUP_FILE" rsync -av --progress "$FULL_BACKUP_PATH" "$PHOTOS_DESTINATION" if [ $? -eq 0 ]; then - echo "Success: Most recent Photos backup '$LATEST_BACKUP_FILE' copied to '$PHOTOS_DESTINATION'." - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Most recent Photos backup copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Success: Most recent Immich database backup '$LATEST_BACKUP_FILE' copied to '$PHOTOS_DESTINATION'." + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Most recent Immich database backup copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else - echo "Error: rsync failed to copy photos backup file '$LATEST_BACKUP_FILE'. Please check permissions." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy most recent Photos backup." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: rsync failed to copy most recent Immich database backup file '$LATEST_BACKUP_FILE'. Please check permissions." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy most recent Immich database backup." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 fi fi fi @@ -175,16 +175,16 @@ fi # ============================================================================== echo "Starting rsync of '$PHOTOS_LIBRARY_SOURCE' to '$PHOTOS_DESTINATION'..." if [ ! -d "$PHOTOS_LIBRARY_SOURCE" ]; then - echo "Error: Photos source directory '$PHOTOS_LIBRARY_SOURCE' not found." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. Photos library source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: Immich Library source directory '$PHOTOS_LIBRARY_SOURCE' not found." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. Immich library source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else rsync -av --progress "$PHOTOS_LIBRARY_SOURCE" "$PHOTOS_DESTINATION" if [ $? -eq 0 ]; then - echo "Success: Photos library directory copied to '$PHOTOS_DESTINATION'." - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Photos library copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Success: Immich library directory copied to '$PHOTOS_DESTINATION'." + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Immich library copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else - echo "Error: rsync failed to copy photos library directory. Please check permissions." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy photos library directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: rsync failed to copy Immich library directory. Please check permissions." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy Immich library directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 fi fi @@ -193,16 +193,16 @@ fi # ============================================================================== echo "Starting rsync of '$PHOTOS_PROFILE_SOURCE' to '$PHOTOS_DESTINATION'..." if [ ! -d "$PHOTOS_PROFILE_SOURCE" ]; then - echo "Error: Photos source directory '$PHOTOS_PROFILE_SOURCE' not found." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. Photos profile source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: Immich Profile source directory '$PHOTOS_PROFILE_SOURCE' not found." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Immich Profile directory copy failed. Profile directory source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else rsync -av --progress "$PHOTOS_PROFILE_SOURCE" "$PHOTOS_DESTINATION" if [ $? -eq 0 ]; then - echo "Success: Photos profile directory copied to '$PHOTOS_DESTINATION'." - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Photos profile copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Success: Immich profile directory copied to '$PHOTOS_DESTINATION'." + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Immich profile directory copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else - echo "Error: rsync failed to copy photos profile directory. Please check permissions." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy photos profile directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: rsync failed to copy Immich profile directory. Please check permissions." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy Immich profile directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 fi fi @@ -211,16 +211,16 @@ fi # ============================================================================== echo "Starting rsync of '$PHOTOS_UPLOAD_SOURCE' to '$PHOTOS_DESTINATION'..." if [ ! -d "$PHOTOS_UPLOAD_SOURCE" ]; then - echo "Error: Photos source directory '$PHOTOS_UPLOAD_SOURCE' not found." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Script failed. Photos upload source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: Immich upload source directory '$PHOTOS_UPLOAD_SOURCE' not found." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: Immich Upload directory copy failed. Upload directory source not found." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else rsync -av --progress "$PHOTOS_UPLOAD_SOURCE" "$PHOTOS_DESTINATION" if [ $? -eq 0 ]; then - echo "Success: Photos upload directory copied to '$PHOTOS_DESTINATION'." - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Photos upload copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Success: Immich upload directory copied to '$PHOTOS_DESTINATION'." + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Success: Immich upload directory copied to $PHOTOS_DESTINATION" "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 else - echo "Error: rsync failed to copy photos upload directory. Please check permissions." >&2 - curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy photos upload directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 + echo "Error: rsync failed to copy Immich upload directory. Please check permissions." >&2 + curl -H "Authorization: Bearer $NTFY_TOKEN" -d "Error: rsync failed to copy Immich upload directory." "$NTFY_SERVER/$NTFY_TOPIC" > /dev/null 2>&1 fi fi