added gotify settings
This commit is contained in:
parent
238dbfbe67
commit
0c26ce1f87
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
{%- if pillar['pods']['mariadb'] is defined %}
|
{%- if pillar['pods']['mariadb'] is defined %}
|
||||||
umask 0077
|
umask 0077
|
||||||
|
GOTIFY_URL="{{ pillar.restic.gotify.url }}"
|
||||||
|
GOTIFY_TITLE="$(hostname)"
|
||||||
|
GOTIFY_TOKEN="{{ pillar.restic.gotify.token }}"
|
||||||
|
GOTIFY_PRIO="5"
|
||||||
BACKUP_DIR={{ pillar.pods.mariadb.containers.main.backup_dir }}
|
BACKUP_DIR={{ pillar.pods.mariadb.containers.main.backup_dir }}
|
||||||
databases=$(podman exec -it mariadb-main mariadb -B -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} -e "SHOW DATABASES;" | tr -d "| " | grep -v Database)
|
databases=$(podman exec -it mariadb-main mariadb -B -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} -e "SHOW DATABASES;" | tr -d "| " | grep -v Database)
|
||||||
|
|
||||||
@ -84,11 +88,17 @@ podman run --rm \
|
|||||||
|
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
|
||||||
|
|
||||||
{%- if pillar['containers']['freeipa'] is defined %}
|
{%- if pillar['containers']['freeipa'] is defined %}
|
||||||
echo "Starting FreeIPA"
|
echo "Starting FreeIPA"
|
||||||
systemctl start freeipa.service
|
systemctl start freeipa.service
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
MESSAGE="$(journalctl -u restic-backup.service --since today | grep Error)"
|
||||||
|
if [[ "$MESSAGE" != "-- No entries --" ]]; then
|
||||||
|
curl "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" -F "title=$GOTIFY_TITLE" -F "priority=$GOTIFY_PRIO" -F "message=$MESSAGE"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $return_code -eq 0 ]]; then
|
if [[ $return_code -eq 0 ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user