initial commit
This commit is contained in:
26
hooks/ntfy-error.sh
Executable file
26
hooks/ntfy-error.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user