8000 Sending mail on post backup · Issue #53 · djmaze/resticker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sending mail on post backup #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
e-belair opened this issue Sep 30, 2020 · 2 comments
Closed

Sending mail on post backup #53

e-belair opened this issue Sep 30, 2020 · 2 comments

Comments

@e-belair
Copy link

Hi,
How are you doing to send mail on post backup?
I tried to use a script but the mail command does not exists on the container

@djmaze
Copy link
Owner
djmaze commented Sep 30, 2020

I propose you use a separate container for that, like apprise-microservice. See here for an example: #29 (comment)

@e-belair
Copy link
Author
e-belair commented Oct 1, 2020

I've finally implemented a script that installs msmtp and send a mail containing the logs of the backup:

send-mail.sh
# Install msmtp if not exists
if ! command -v msmtp &> /dev/null
then
  apk add --update --no-cache msmtp
  ln -sf /usr/bin/msmtp /usr/sbin/sendmail
fi

DCLOGS=$(docker logs --since "10h" -t resticker)

echo -e "Subject: Restic backup $1\n\nLast 10 hours logs:\n${DCLOGS}\n" | msmtp "${DEST_MAIL}"

In my dc file I'm using it like this:

      POST_COMMANDS_SUCCESS: |-
        /scripts/send-mail.sh SUCCESS
      POST_COMMANDS_FAILURE: |-
        /scripts/send-mail.sh FAILURE
      DEST_MAIL: admin@domain.tld

I'll look into the notification service, may be interesting as global notification for all my apps

@e-belair e-belair closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0