Stefan Fleischmann
2015-07-04 21:44:14 UTC
In many host configuration files I have an override for EMailAdminUserName.
What happens now is that backuppc's sysadmin mail is sent to the user
specified in EMailAdminUserName of the last host I added.
contain the username specified as an override in the host configuration
processed last and not the value from the main configuration anymore. But
attached patch). That fixes the issue for me but since I'm not familiar with
Perl I wonder if that's the correct way to do it.
Best,
Stefan
What happens now is that backuppc's sysadmin mail is sent to the user
specified in EMailAdminUserName of the last host I added.
foreach my $host ( sort(keys(%Status)) ) {
#
# read any per-PC config settings (allowing per-PC email settings)
#
$bpc->ConfigRead($host);
%Conf = $bpc->Conf();
The problem is that after the loop is done $Conf{EMailAdminUserName} will#
# read any per-PC config settings (allowing per-PC email settings)
#
$bpc->ConfigRead($host);
%Conf = $bpc->Conf();
contain the username specified as an override in the host configuration
processed last and not the value from the main configuration anymore. But
if ( $adminMesg ne "" && $Conf{EMailAdminUserName} ne "" ) {
my $headers = $Conf{EMailHeaders};
$headers .= "\n" if ( $headers !~ /\n$/ );
$adminMesg = <<EOF;
To: $Conf{EMailAdminUserName}
Subject: BackupPC administrative attention needed
$headers
${adminMesg}Regards,
PC Backup Genie
EOF
SendMail($adminMesg);
}
I inserted a line to read the main configuration again after the loop (seemy $headers = $Conf{EMailHeaders};
$headers .= "\n" if ( $headers !~ /\n$/ );
$adminMesg = <<EOF;
To: $Conf{EMailAdminUserName}
Subject: BackupPC administrative attention needed
$headers
${adminMesg}Regards,
PC Backup Genie
EOF
SendMail($adminMesg);
}
attached patch). That fixes the issue for me but since I'm not familiar with
Perl I wonder if that's the correct way to do it.
Best,
Stefan