Error-Mail wenn restic-backup einen Exit-Code !=0 hat (#5)
Link Typo Bugfix: Postfix - tlx-param Mailversand - wip Syntax Rolle postfix als Voraussetzung für restic Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com> Reviewed-on: mg/ansible#5
This commit is contained in:
parent
2a78a95724
commit
ffe99130f9
3 changed files with 11 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
|||
gmail_mail_nach_cronjob: false
|
||||
gmail_smtp_server: smtp.gmail.com
|
||||
gmail_smtp_server_port: 587
|
||||
gmail_smtp_use_tls: yes
|
||||
gmail_smtp_use_tls: "yes"
|
||||
### mgrote.set_apt_sources
|
||||
acng_server: acng.grote.lan
|
||||
acng_server_port: 9999
|
||||
|
|
3
roles/mgrote.restic/meta/main.yml
Normal file
3
roles/mgrote.restic/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- role: mgrote.postfix-gmail
|
|
@ -19,12 +19,18 @@ function unlock() {
|
|||
# Damit prueft ob das Script ob es schon laeuft
|
||||
exlock
|
||||
(
|
||||
echo "--------------------------------------------------"
|
||||
echo "--------------------------------------------------"
|
||||
echo $(date)
|
||||
|
||||
mount -t cifs -o credentials="/etc/restic/smb_password.txt",vers=3.0 {{ restic_repository }} {{ restic_mount }}
|
||||
|
||||
restic -r {{ restic_mount }} --password-file /etc/restic/password.txt backup --exclude-file /etc/restic/exclude.txt {{ restic_folders_to_backup }}
|
||||
# Mail wenn Restix Exit != 0 #https://stackoverflow.com/a/45817972
|
||||
retVal=$?
|
||||
if [ $retVal -ne 0 ]; then
|
||||
echo "ERROR - Restic - $HOSTNAME" | mail -s "ERROR - Restic - $HOSTNAME" {{ empfaenger_mail }}
|
||||
fi
|
||||
|
||||
|
||||
umount {{ restic_mount }}
|
||||
echo "--------------------------------------------------"
|
||||
|
|
Loading…
Reference in a new issue