Show backup size instead of repository in success notifications
Some checks failed
Deploy Borgmatic Configuration / Deploy to Production Server (push) Has been cancelled

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 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-18 15:38:24 +01:00
parent 9c03ebf8e2
commit 6f968f73c4

View File

@@ -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"