aboutsummaryrefslogtreecommitdiffstats
path: root/lifeboat
diff options
context:
space:
mode:
Diffstat (limited to 'lifeboat')
-rwxr-xr-xlifeboat17
1 files changed, 17 insertions, 0 deletions
diff --git a/lifeboat b/lifeboat
index e84c916..b8724fc 100755
--- a/lifeboat
+++ b/lifeboat
@@ -18,6 +18,22 @@ usage() {
exit 1
}
+report_backup() {
+ cd "$LIFEBOAT_ROOT/$repo"
+
+ test -r config/recipient || errx "Could not read recipient from config/recipient"
+ read -r recipient < config/recipient
+ test -n "$recipient" || errx "No recipient given in config/recipient"
+
+ cat <<-EOF | sendmail "$recipient"
+ From: Lifeboat <lifeboat@$(hostname -f)>
+ Subject: lifeboat: backup for $(hostname) on $(date)
+ X-Report: lifeboat
+
+ $(run_backup 2>&1)
+ EOF
+}
+
run_backup() {
cd "$LIFEBOAT_ROOT/$repo"
@@ -75,5 +91,6 @@ export RESTIC_PASSWORD_FILE=$LIFEBOAT_ROOT/$repo/credentials/restic
case "$1" in
run) run_backup;;
+ run-report) report_backup;;
*) restic "$@";;
esac