mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
15 lines
481 B
Django/Jinja
15 lines
481 B
Django/Jinja
#!/bin/bash
|
|
set -u
|
|
|
|
invocation_id=$(systemctl show -p InvocationID --value {{ app }}.service)
|
|
hostname=$(hostname)
|
|
subject="YunoHost Restic backup log on ${hostname}"
|
|
backup_results=$(sudo /bin/journalctl _SYSTEMD_INVOCATION_ID=${invocation_id} | grep -oP '(?<= )[a-zA-Z_-]+: \w+')
|
|
echo ${backup_results} | grep -iqE 'error|fail'
|
|
if [ "$?" -eq 0 ];then
|
|
subject="${subject} (FAIL)"
|
|
else
|
|
subject="${subject} (SUCCESS)"
|
|
fi
|
|
|
|
echo "${backup_results}" | mail -s "${subject}" root
|