1
Fork 0
mirror of https://github.com/Steffo99/backup-duplicity.git synced 2025-02-16 21:34:03 +00:00

Fix ntfy messages

This commit is contained in:
Steffo 2025-01-19 14:15:53 +01:00
parent 61cd250c56
commit 0ffa37d684
Signed by: steffo
GPG key ID: 6B8E18743E7E1F86
2 changed files with 5 additions and 3 deletions

View file

@ -39,7 +39,8 @@ if [ -n "${NTFY}" ]; then
case "$backup_result" in
0)
echo "Sending ntfy backup complete notification..." >> /dev/stderr
ntfy_message=$(printf "Duplicity has successfully performed a backup to **${DUPLICITY_TARGET_URL}**!\n\n```\n")$(cat "/var/log/gestalt-amadeus/log.txt")$(printf "\n```")
backup_summary=$(grep --fixed-strings --after-context='16' --regexp='--------------[ Backup Statistics ]--------------' "/var/log/gestalt-amadeus/log.txt")
ntfy_message=$(printf "Duplicity has successfully performed a backup to **%s**!\n\n\`\`\`\n%s\n\`\`\`" "$DUPLICITY_TARGET_URL" "$backup_summary")
curl "${NTFY}" \
--silent \
--header "X-Title: Backup complete" \
@ -51,7 +52,8 @@ if [ -n "${NTFY}" ]; then
;;
*)
echo "Sending ntfy backup failed notification..." >> /dev/stderr
ntfy_message=$(printf "Duplicity failed to perform a backup to **${DUPLICITY_TARGET_URL}**, and exited with status code **${backup_result}**.\n\n```\n")$(cat "/var/log/gestalt-amadeus/log.txt")$(printf "\n```")
backup_log=$(grep --fixed-strings --after-context='16' --regexp='--------------[ Backup Statistics ]--------------' "/var/log/gestalt-amadeus/log.txt")
ntfy_message=$(printf "Duplicity has failed to perform a backup to **%s**.\n\n\`\`\`\n%s\n\`\`\`" "$DUPLICITY_TARGET_URL" "$backup_log")
curl "${NTFY}" \
--silent \
--header "X-Title: Backup failed" \

View file

@ -18,7 +18,7 @@ duplicity \
| tee "/var/log/gestalt-amadeus/log.txt"
ntfy_message=$(printf "Duplicity has successfully restored a backup from **${DUPLICITY_TARGET_URL}**!\n\n```\n")$(cat "/var/log/gestalt-amadeus/log.txt")$(printf "\n```")
ntfy_message=$(printf "Duplicity has successfully restored a backup from **%s**!" "${DUPLICITY_TARGET_URL}")
curl "${NTFY}" \
--silent \