#!/bin/bash # # Hook Borgmatic - Notification de succès via ntfy # Borgmatic 2.0 utilise des variables d'environnement # # Charger les variables d'environnement if [ -f /etc/borgmatic/.env ]; then source /etc/borgmatic/.env fi # Récupérer le nom de la dernière archive créée # Borgmatic 2.0 expose BORG_REPO et autres variables d'environnement ARCHIVE_NAME=$(borgmatic list --last 1 --short 2>/dev/null | tail -1) if [ -z "$ARCHIVE_NAME" ]; then ARCHIVE_NAME="dernière archive" fi # Envoyer notification de succès curl -s -u "$NTFY_USER" \ -H "Title: ✅ Backup réussi" \ -H "Priority: default" \ -H "Tags: white_check_mark,backup" \ -d "Backup terminé avec succès. Archive: ${ARCHIVE_NAME} Date: $(date '+%Y-%m-%d %H:%M:%S') Repository: ${BORG_REPO}" \ "$NTFY_URL" echo "Notification de succès envoyée à ntfy" exit 0