From 6f968f73c44d6d089f0c12b5175e7e12f28fb230 Mon Sep 17 00:00:00 2001 From: BeauTroll <-> Date: Thu, 18 Dec 2025 15:38:24 +0100 Subject: [PATCH] Show backup size instead of repository in success notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace repository path with backup size in ntfy success notifications to provide more useful information about backup completion. Changes: - Add backup size retrieval using borgmatic info command - Display original size in notification instead of repository path - Fallback to "taille inconnue" if size cannot be determined 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- hooks/ntfy-success.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hooks/ntfy-success.sh b/hooks/ntfy-success.sh index 518b7d7..8ea5293 100755 --- a/hooks/ntfy-success.sh +++ b/hooks/ntfy-success.sh @@ -16,6 +16,12 @@ if [ -z "$ARCHIVE_NAME" ]; then ARCHIVE_NAME="dernière archive" fi +# Récupérer la taille du backup +BACKUP_SIZE=$(borgmatic info --archive "$ARCHIVE_NAME" 2>/dev/null | grep -E "Original size|This archive" | head -1 | awk '{print $(NF-1), $NF}') +if [ -z "$BACKUP_SIZE" ]; then + BACKUP_SIZE="taille inconnue" +fi + # Envoyer notification de succès curl -s -u "$NTFY_USER" \ -H "Title: ✅ Backup réussi" \ @@ -24,7 +30,7 @@ curl -s -u "$NTFY_USER" \ -d "Backup terminé avec succès. Archive: ${ARCHIVE_NAME} Date: $(date '+%Y-%m-%d %H:%M:%S') -Repository: ${BORG_REPO}" \ +Taille: ${BACKUP_SIZE}" \ "$NTFY_URL" echo "Notification de succès envoyée à ntfy"