Script E-Mail Notification for borg backup



  • Hi,

    pfSense 2.4.4

    we use borg to backup our Linux servers. Since there's a portable borg binary for freebsd which works quite nice with pfsense we decided to backup pfSense via borg, too.

    I wrote a script that inits, creates, lists or prunes a backup. Then I installed the pfsense cron package to schedule the tasks. Everything is working as expected.

    There's only one task left for me. I want a notification if the backup fails via E-Mail.
    I setup E-Mail Notifications under System - Advanced - Notifications.
    Is there any trivial way to utilize this setup?

    I only found very old threads about this topic that actually do not help. That's why I created a new thread.

    Thank you
    pmisch


  • Rebel Alliance Developer Netgate

    Depends on how the program intends to send e-mail. If it relies on sendmail being installed, it may not work. You might try installing the arpwatch package, though. It installs a stub that pretends to be sendmail but uses the GUI mail notification settings.



  • Thanks for the fast answer. It's a shell script I wrote so the only requirement for the method is that I can do it via command line.

    I installed pfSense-pkg-arpwatch and tried successfully via: echo "test" | sendmail recipient@email.com

    The only downside is that the sender is "Arpwatch Notification" but since that's only cosmetic I will stick to this approach.
    Thank you

    Edit:
    As it turns out there's a mail.php that I can utilize, without the need to install arpwatch package and without the cosmetic flaws. echo "test" | mail.php -s"subject" recipient@email.com