aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/borg-client/templates/bin/create-backup-send-email
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-12-27 15:10:41 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-12-27 15:10:41 +0100
commita4d189208a4108bd430891928764f9feb921f888 (patch)
tree367ebfa782afd7a614c9b174ae2a7497ccef3d1a /ansible/roles/borg-client/templates/bin/create-backup-send-email
parent37e93cced23e0ee726309e841b1dac19e9ccdac4 (diff)
downloadinfra-a4d189208a4108bd430891928764f9feb921f888.tar.gz
infra-a4d189208a4108bd430891928764f9feb921f888.tar.bz2
infra-a4d189208a4108bd430891928764f9feb921f888.tar.xz
infra-a4d189208a4108bd430891928764f9feb921f888.zip
o Sending email after creating backup.
Diffstat (limited to 'ansible/roles/borg-client/templates/bin/create-backup-send-email')
-rw-r--r--ansible/roles/borg-client/templates/bin/create-backup-send-email17
1 files changed, 17 insertions, 0 deletions
diff --git a/ansible/roles/borg-client/templates/bin/create-backup-send-email b/ansible/roles/borg-client/templates/bin/create-backup-send-email
new file mode 100644
index 0000000..65286b1
--- /dev/null
+++ b/ansible/roles/borg-client/templates/bin/create-backup-send-email
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /
+
+
+/usr/sbin/sendmail -t <<ERRMAIL
+To: $1
+From: systemd <root@$HOSTNAME>
+Subject: Backup @ $HOSTNAME
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+$(systemctl status --full 2>&1)
+$(journalctl --since today --unit create-backup 2>&1)
+ERRMAIL