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
|
||||
30
hooks/ntfy-success.sh
Executable file
30
hooks/ntfy-success.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Hook Borgmatic - Notification de succès via ntfy
|
||||
# Arguments: $1 = archive_name, $2 = stats
|
||||
#
|
||||
|
||||
# Charger les variables d'environnement
|
||||
if [ -f /etc/borgmatic/.env ]; then
|
||||
source /etc/borgmatic/.env
|
||||
fi
|
||||
|
||||
ARCHIVE_NAME="${1:-inconnu}"
|
||||
STATS="${2:-}"
|
||||
|
||||
# Extraire la taille depuis les stats si disponible
|
||||
# Borgmatic passe les stats en JSON, on peut parser ou utiliser directement
|
||||
SIZE="voir logs pour détails"
|
||||
|
||||
# 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')" \
|
||||
"$NTFY_URL"
|
||||
|
||||
echo "Notification de succès envoyée à ntfy"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user