Bacula-users

Re: [Bacula-users] Question regarding messages

2009-09-21 07:43:28
Subject: Re: [Bacula-users] Question regarding messages
From: Hannes Gruber <bacula01 AT usw DOT at>
To: bacula AT ruben DOT cn
Date: Mon, 21 Sep 2009 13:38:55 +0200
Juche,

> In one of your bacula servers, we need a set of jobs to send 2 kind of emails 
> for every job. The only
> difference between mails os the subject. The differences are on the arguments 
> given to the "mailcommand"
> entry, as we need one of the mails to have one kind of internal code for 
> automatic processing, and the other
> mail having a normal combination of % parameters. How can I achieve this? Is 
> this possible?
Why not write a wrapper script that you place into the Mailcommand
Directive of the Messages Resource like:

Messages {
  mailcommand = "/bin/bash -c 'wrapper \"%j\" \"%r\" \"%d\" \"%e\"' "
  ...
}


Placve as much % Placeholder into that section as you need. You can
access those from inside your script by using $1 $2 ... $x. But I assume
that you know this.

In the script the most important part will be that you redirect STDIN
into a Variable that you can use for sending the mails:

#!/bin/bash
mail="$(cat)"
echo "$mail" | /usr/sbin/bsmtp \
    -h localhost -f "Bacula Backup $1 <$1 AT usw DOT at>" \
    -s "Bacula: $2 $3 of $4 $5"

echo "$mail" | /usr/sbin/bsmtp \
    -h localhost -f "Bacula Backup $1 <$1 AT usw DOT at>" \
    -s "My internal ID: $5"



This way you can send as many emails as you like, you can eaven pipe
$mail throug AWK first to change the content of the mail or play around
with it.

If you find a solution for your Problem please let us know, so that we
can learn from your genius solutions.

Hannes




------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>