diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-05-30 13:56:03 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-05-30 13:56:03 +0300 |
commit | e85656cb09fc8759fbd5731ed60915a0631eafb3 (patch) | |
tree | 741a99c355052b48b2675805e9e61866bf9941d2 | |
parent | b52f77e1fbf3fa50bfc345acd7029320b68c5aff (diff) | |
download | beam-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.in | 14 |
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 } |