I have rsnapshot running a system of backups and I want to be notified by email at the end of the daily backup.
This is the command running the cron job:
50 2 * * * /etc/rsnapshot_daily 2>&1 | sh /home/marc/rsnapshot_log.sh
and this is the rsnaphot_log script to send me the email:
tail -14 /var/log/rsnapshot 2>&1 | mail -v -s "rsnapshot_daily" firstname.lastname@example.org
The backup works fine and I do get the email, but the mail is sent before the backup finishes, which means the content of the email is relevant to a previous backup.
How can I get the rsnapshot_log script to be executed only after the backup has successfully