A new version of the Google Site Search module for Joomla 2.5 was published get more infos here.

IT-Blog

sending bacula status mails with smtp authentication

mailYesterday i decided to enable the mailing feature of bacula, to keep informed about backups that did not work.

Normally you can easily configure that in the bacula-dir.conf file, by uncommenting/setting the mailcommand and the email-address.
The default entries look similar to this:

 

1
mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\"
 -s \"Bacula: %t %e of %c %l\" %r"
mail = root@localhost = all, !skipped

 

The mailcommand bsmtp is a bacula-builtin and the %r gets replaced with the email-address from "mail".
In this example all mails except the skipped ones get sent to root@localhost.

In my case i could not use bsmtp because i need authentication on the smtp server to send mails, like gmail also needs.
So i had to look for an alternative and i found sendEmail that is also available as Debian package.
sendEmail is a very powerful smtp-command-line tool. The installation on Debian is quite simple.

 

1
apt-get install sendemail

 

Now i changed the mailcommand to the following: (you have to put it in one line!)


1
 mailcommand = "/usr/bin/sendEmail -f Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein! -t
%r -u \"Bacula: %t %e of %c %l\" -m Intervention needed! -s
smtp.mymailserver.at -o tls=no -xu myusernamer -xp mypassword"

 

-f is the from address
-t is the target %r gets replaced by bacula with the mail-address defined
-u is the subject that will look like "Bacula: Backup ERROR of HostBacula Full" in the mail.
-m is the mail body, i really dont know how to put the errorlog for this one job in there...
-s is the mailserver
-o is the authentication, if you want it more secure you should use tls
-xu username
-xp password

I choose to use "MailOnError", because i check all jobs and logs on a regular base so i just want a quick inform if an error occured, if you use "mail" then you get also informed about succesfully terminated jobs.

  • Iznatoraf

    Posted at 2010-07-02 08:50:20

    Very useful. Thank you so much!!!

    Auf Kommentar antworten

  • Robert Poehler Ledermüller

    Posted at 2010-04-10 23:46:20

    Thank you for that tip. I have tried to get statusmail working very long. With your solution it now works very well for me.

    Auf Kommentar antworten

  • Gustavo A. Díaz

    Posted at 2010-04-08 21:57:06

    I was looking for this to, and you dont need to specify the -m, since bacula adds the body message by stdin. So, the way as example should be:

    mailcommand = "/usr/bin/sendEmail -s mail.example.com -xu mailsend@example.com -xp mailpasswd -f "(Bacula) " -u "Bacula: %t %e of %c %l" -t %r"
    operatorcommand = "/usr/bin/sendEmail -s mail.example.com -xu mailsend@example.com -xp mailpasswd -f "(Bacula) " -u "Bacula: Intervention needed for %j" -t %r"

    Cheers.

    Auf Kommentar antworten

Veröffentlichen Sie ihre Kommentare ...


Warning: Creating default object from empty value in /www/htdocs/w0101274/www/fairtec.at/modules/mod_udjacomments/helper.php on line 387