email Notifications with attachment via script

  • Hello friends of OMV :)


    i made a simple script for a rsync job, ther pulls Data from my Synology to my OMV box.

    This works as suspected :thumbup:


    Now I want to get an email with a summery in the end of the job.


    My rsync job looks like this (rsync.log for OMV interface and rsync.txt for email attachment):

    rsync -ahv --delete --stats --log-file="/var/log/rsync.log" --log-file="/var/log/rsync.txt" -e "ssh -p 222 -i /etc/ssh/openmediavault-06d0beb8-a3dc-4bde-a404-1092fc1810b3" MyUser@192.168.1.6::Thumbnails /srv/afece2ad-7c23-492c-a29c-69657c1f5d0d/Syno_Backups/Thumbnails/



    As I read here, OMV uses "mail" as a Linux command to send mails.

    After a few tries with -A (like described here), I found out, that it has to be a small -a bevore the mail address.

    So I try to use this after my rsync:

    echo "rsync finished. Find output attached as rsync.txt" | mail -s "rsync finished" -a "/var/log/rsync.txt" MyPersonal@mail.com

    But this does not work.


    I testet without attachment, and this worked like a charm, but with -a and and attachment it did not work.


    My email just looks like this (without attachment):


    After a search for help I found this site, but I cannot get this working in OMV :(



    Can anybody help me getting a short mail with the rsync log in the end?

    Best would be with subject If it failed or succeeded ;)


    Any help appreciated :S

    Thank u

    OMV 5.6.9-1 (Usul) // ASRock J5040-ITX // be quiet! ATX 500W (BN46) // 2x4GB Samsung M471A5244BB0-CRC

    Fractal Design Node 304 // 4-Port PCIE to SATA 3.0 ControllerCard // 1x 128GB SSD, 3x 4TB and 1x 5TB HDD

  • Aaaaand IT WORKED :thumbup::)


    Thank u very much.

    I think i forgot to read the little small lines in my links :rolleyes:


    Tested with s-nail and it workes like a charme.


    Problem solved :S

    OMV 5.6.9-1 (Usul) // ASRock J5040-ITX // be quiet! ATX 500W (BN46) // 2x4GB Samsung M471A5244BB0-CRC

    Fractal Design Node 304 // 4-Port PCIE to SATA 3.0 ControllerCard // 1x 128GB SSD, 3x 4TB and 1x 5TB HDD

  • macom

    Added the Label resolved

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!