sending mail after successful backup

In case you want cron to tell you that your backup job has been finished you can use MSMTP to send you the logs for your cronjob via e-mail:

After install with apt-get install mstmp, setup aliases in your /etc/aliases file:

root: root@example.com
user: user@example.com
default: email@example.com

Then make sure your config in /etc/msmtprc looks something like this:

# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account gmail
host smtp.gmail.com
from <user>@gmail.com
auth on
user <user>
password <your password>
# Set a default account
account default : gmail

Then you are ready to test:

echo -e "Subject: msmtp test\nhello test." | msmtp email@arvidortwig.de

To make the finished cron job send the mail add something like the following to your /etc/crontab or crontab -e

* * * * *   /scripts/backup.sh 2>&1 | msmtp youremail@provider.com