diff options
-rwxr-xr-x | lifeboat | 17 | ||||
-rw-r--r-- | lifeboat.1 | 12 |
2 files changed, 28 insertions, 1 deletions
@@ -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 @@ -1,4 +1,4 @@ -.Dd January 17, 2020 +.Dd April 30, 2021 .Dt LIFEBOAT 1 .Os .Sh NAME @@ -24,6 +24,11 @@ or as follows: .Bl -tag -width Ds .It Sy run Create a snapshot for the specified repository. +.It Sy run-report +Like +.Sy run , +but send any program output to the mail address specified in +.Pa config/recipient . .El .Sh DIRECTORY STRUCTURE .Nm @@ -78,6 +83,11 @@ if the combined size of the repository is below 10G: .Bd -literal -offset indent nas:backups/ 10485760 .Ed +.It Sy config/recipient +A file containing the mail address of the recipient for backup reports. +Only needed for the +.Sy run-report +command. .It Sy credentials/restic A file containing the password for the .Xr restic 1 |