#!/bin/bash # # Hook Borgmatic - Notification d'erreur via ntfy # Arguments: $1 = error message # # Charger les variables d'environnement if [ -f /etc/borgmatic/.env ]; then source /etc/borgmatic/.env fi ERROR_MSG="${1:-Erreur inconnue}" # Envoyer notification d'erreur curl -s -u "$NTFY_USER" \ -H "Title: ❌ Backup échoué" \ -H "Priority: high" \ -H "Tags: x,backup,alert" \ -d "Le backup a échoué ! Erreur: ${ERROR_MSG} Date: $(date '+%Y-%m-%d %H:%M:%S') Vérifiez les logs: journalctl -u borgmatic.service -n 50" \ "$NTFY_URL" echo "Notification d'erreur envoyée à ntfy" exit 0