diff --git a/restic/files/backup.sh.jinja b/restic/files/backup.sh.jinja index 07c48e0..044772d 100644 --- a/restic/files/backup.sh.jinja +++ b/restic/files/backup.sh.jinja @@ -6,6 +6,11 @@ export RESTIC_REPOSITORY="stfp:{{ pillar.restic.user }}@{{ pillar.restic.host }} {%- endif %} export RESTIC_PASSWORD={{ pillar.restic.password }} +GOTIFY_URL="{{ pillar.restic.gotify.url }}" +GOTIFY_TOKEN="{{ pillar.restic.gotify.token }}" +GOTIFY_PRIO="5" +GOTIFY_TITLE="backup on $HOSTNAME" + restic backup \ --exclude="*.tmp" \ --exclude="lost+found" \ @@ -49,3 +54,10 @@ restic backup \ /etc \ /root \ /home + +return_code="$?" +if [[ "$return_code" == "0" ]]; then + exit 0 +fi +MESSAGE="$(journalctl -u restic-backup.service -p 5 --since today)" +curl "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" -F "title=$GOTIFY_TITLE" -F "priority=$GOTIFY_PRIO" -F "message=$MESSAGE"