Skip to content

Instantly share code, notes, and snippets.

@skarllot
Last active March 28, 2024 23:35
Show Gist options
  • Save skarllot/7604849 to your computer and use it in GitHub Desktop.
Save skarllot/7604849 to your computer and use it in GitHub Desktop.
Bacula configuration to use sendEmail
. . .
Messages {
Name = Standard
mailcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] %t %e of %n %l\" \"%r\""
operatorcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] Intervention needed for %j\" \"%r\""
mail = backup-handlers@example.com = all, !skipped
operator = backup-operator@example.com = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
mailcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] Alert message\" \"%r\""
mail = backup-handlers@example.com = all, !skipped
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
}
. . .
#!/bin/bash
SMTP_SERVER=smtp.example.com
USER=smtpuser
PASSWORD=smtppassword
SENDER=backup@example.com
SUBJECT=$1
RECIPIENTS=$2
/usr/local/bin/sendEmail -q -s $SMTP_SERVER -xu $USER -xp $PASSWORD -f $SENDER -u $SUBJECT -t $RECIPIENTS
@skarllot
Copy link
Author

You a SMTP server to send yours emails or you enable it from Gmail configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment