zertrin/duplicity-backup.sh

Two problems with the email notifications

Closed this issue · 7 comments

Hello folks, I am using this wonderful script but I have noticed a couple of problems:

  1. when the --dry-run option is on, the email is still sent (or attempted)
  2. when trying to send the email I receive the following error:
"[MY_HOSTNAME]" contains invalid character '['
"MY_HOME/dead.letter" 24/849
MY_TERMINAL_PROMPT?$ smtp-server: 553-5.1.2 The recipient address <duplicity-.log> is not a valid RFC-5321
smtp-server: 553 5.1.2 address. n80sm10634002pfi.19 - gsmtp
"MY_HOME/dead.letter" 24/849
... message not sent

Thanks a lot for your work and I will try to investigate as well!

Hi,

Thanks for reporting these problems.

  1. Concerning the --dry-run option, I'm gonna look into it, since it currently doesn't really do what it looks it should do (and not only about sending email or notifications). In fact what it currently does is only to pass the option to duplicity at the beginning of the static options. After a quick look, I see the need to rework the whole thing about dry-run.

  2. could you give some more information in order for me to be able to understand what is going on and/or reproduce it.

  • which MAIL="xxxxxx" do you have in your config file?
  • Assuming you are on a Debian/Ubuntu based distribution, what is the result of dpkg -S $(readlink -e $(which xxxxxx)) (replace xxxxxx with what is in your MAIL variable from above). If using a distro which doesn't manage .deb packages, do you know which package provides your xxxxxx?

@zertrin thanks for anwsering, I have MAIL="mailx" and working on ubuntu and mailx is pointing to s-nail: /usr/bin/s-nail

So probably the hostname is generated with [ ] around.

Ok thanks for the info!

The main issue with trying to send automated emails from a Linux system, is that behind the seemingly same-looking names of mail or mailx, there is plenty of different implementations. As you can see from the lines 435-500 of the script, I need to try to detect which one is used, and call the command with different parameters depending on which program is hiding behind mailx.

I already had the cases implemented for bsd-mailx, heirloom-mailx and mail.mailsutils, but not for s-nail.

Now that I have found the manpage for s-nail, I will look into adding a case for it in the script.

Could you try the branch fix-issue-135-s-nail? (pull request #138)

Ok I assume your thumbs-up means that you tested and that it works. I'll merge the PR.

PS: emoji reaction are nice (I like them a lot too) but they don't produce a notification. So I wasn't aware of your thumbs-up until I checked back manually this page ;)

No ooops, emoji are not nice :) I know you don't receive notification and I just wanted to communicate that I saw the message and I am going to try. Please don't merge if you haven't already, I did not have time yesterday and I will probably try today ;)

I confirm that the email works now