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

    7.0.4-2 (Sandworm) // ASRock J5040-ITX with Intel(R) Pentium(R) Silver J5040 CPU @ 2.00GHz // be quiet! ATX 500W (BN46) // 2x4GB Samsung M471A5244BB0-CRC

    Fractal Design Node 304 // 4-Port PCIE to SATA 3.0 ControllerCard // 1x 128GB SSD for OS and 2x 4TB, 1x 5TB and 3x 8TB HDD as one big fuse.mergerfs space (no need for raid parity)

  • 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

    7.0.4-2 (Sandworm) // ASRock J5040-ITX with Intel(R) Pentium(R) Silver J5040 CPU @ 2.00GHz // be quiet! ATX 500W (BN46) // 2x4GB Samsung M471A5244BB0-CRC

    Fractal Design Node 304 // 4-Port PCIE to SATA 3.0 ControllerCard // 1x 128GB SSD for OS and 2x 4TB, 1x 5TB and 3x 8TB HDD as one big fuse.mergerfs space (no need for raid parity)

  • macom

    Hat das Label gelöst hinzugefügt.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!