aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-05-30 13:56:03 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-05-30 13:56:03 +0300
commite85656cb09fc8759fbd5731ed60915a0631eafb3 (patch)
tree741a99c355052b48b2675805e9e61866bf9941d2
parentb52f77e1fbf3fa50bfc345acd7029320b68c5aff (diff)
downloadbeam-e85656cb09fc8759fbd5731ed60915a0631eafb3.tar.gz
beam-e85656cb09fc8759fbd5731ed60915a0631eafb3.tar.bz2
Honor --dry-run mode when sending mail.
* lib/beam/common.in (dry_mail): New function. (mail_report): Use dry_mail to "send" the message in dry-run mode.
-rw-r--r--lib/beam/common.in14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/beam/common.in b/lib/beam/common.in
index c23baf5..1d4dfd9 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -134,8 +134,19 @@ wtf() {
echo " $s $@"
}
+dry_mail() {
+ echo "============================================================="
+ cat -
+ echo "============================================================="
+}
+
# mail_report FILE
mail_report() {
+ : ${backup_mailer_program:=/usr/sbin/sendmail -oi -t -F $backup_sender_email}
+ if [ -n "$dry_run" ]; then
+ echo "Sending mail using $backup_mailer_program"
+ backup_mailer_program=dry_mail
+ fi
if [ -z "$backup_sender_email" ]; then
backup_sender_email=root@$(hostname)
fi
@@ -171,6 +182,5 @@ EOF
echo "$backup_report_intro"
fi
cat $report
-) | \
- ${backup_mailer_program:-/usr/sbin/sendmail -oi -t -F $backup_sender_email}
+) | $backup_mailer_program
}

Return to:

Send suggestions and report system problems to the System administrator.