added gotify mess on error
This commit is contained in:
parent
35724b700d
commit
20864164be
@ -6,6 +6,11 @@ export RESTIC_REPOSITORY="stfp:{{ pillar.restic.user }}@{{ pillar.restic.host }}
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
export RESTIC_PASSWORD={{ pillar.restic.password }}
|
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 \
|
restic backup \
|
||||||
--exclude="*.tmp" \
|
--exclude="*.tmp" \
|
||||||
--exclude="lost+found" \
|
--exclude="lost+found" \
|
||||||
@ -49,3 +54,10 @@ restic backup \
|
|||||||
/etc \
|
/etc \
|
||||||
/root \
|
/root \
|
||||||
/home
|
/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"
|
||||||
|
Reference in New Issue
Block a user