Alexander Moisseev
2014-01-10 07:29:41 UTC
In some cases nonfatal error may occurs during backup (e.g. xfer errors due to source host filesystem changes). Incomplete or inconsistent backup (even more regular inconsistent backups) requires user attention.
Craig, would you add to BackupPC_sendEmail notification to users if host has recently backed up but nonfatal errors occured during last backup?
Code below is not real patch against BackupPC_sendEmail. Just for illustrate the conception.
if ( time - $last > $Conf{EMailNotifyOldBackupDays} * 24*3600 ) {
my $subj = defined($Conf{EMailNoBackupRecentSubj})
? $Conf{EMailNoBackupRecentSubj}
: $Lang->{EMailNoBackupRecentSubj};
my $mesg = defined($Conf{EMailNoBackupRecentMesg})
? $Conf{EMailNoBackupRecentMesg}
: $Lang->{EMailNoBackupRecentMesg};
my $firstTime = sprintf("%.1f",
(time - $Backups[0]{startTime}) / (24*3600));
my $days = sprintf("%.1f", (time - $last) / (24 * 3600));
sendUserEmail($user, $host, $mesg, $subj, {
firstTime => $firstTime,
days => $days,
userName => user2name($user),
numBackups => $numBackups,
}) if ( !defined($Jobs{$host}) );
next;
}
+ # [-1] in the lines below implies most recent backup for each host.
+ if ( $Backups[-1]{xferErrs}
+ || $Backups[-1]{xferBadShare}
+ || $Backups[-1]{xferBadFile}
+ || $Backups[-1]{tarErrs}
+ ) {
+ #
+ # Here call sendUserEmail() to
+ # send notification to user about errors in last backup
+ #
+ }
if ( $numBadOutlook > 0
&& time - $lastGoodOutlook > $Conf{EMailNotifyOldOutlookDays}
* 24 * 3600 ) {
--
Alexander
Craig, would you add to BackupPC_sendEmail notification to users if host has recently backed up but nonfatal errors occured during last backup?
Code below is not real patch against BackupPC_sendEmail. Just for illustrate the conception.
if ( time - $last > $Conf{EMailNotifyOldBackupDays} * 24*3600 ) {
my $subj = defined($Conf{EMailNoBackupRecentSubj})
? $Conf{EMailNoBackupRecentSubj}
: $Lang->{EMailNoBackupRecentSubj};
my $mesg = defined($Conf{EMailNoBackupRecentMesg})
? $Conf{EMailNoBackupRecentMesg}
: $Lang->{EMailNoBackupRecentMesg};
my $firstTime = sprintf("%.1f",
(time - $Backups[0]{startTime}) / (24*3600));
my $days = sprintf("%.1f", (time - $last) / (24 * 3600));
sendUserEmail($user, $host, $mesg, $subj, {
firstTime => $firstTime,
days => $days,
userName => user2name($user),
numBackups => $numBackups,
}) if ( !defined($Jobs{$host}) );
next;
}
+ # [-1] in the lines below implies most recent backup for each host.
+ if ( $Backups[-1]{xferErrs}
+ || $Backups[-1]{xferBadShare}
+ || $Backups[-1]{xferBadFile}
+ || $Backups[-1]{tarErrs}
+ ) {
+ #
+ # Here call sendUserEmail() to
+ # send notification to user about errors in last backup
+ #
+ }
if ( $numBadOutlook > 0
&& time - $lastGoodOutlook > $Conf{EMailNotifyOldOutlookDays}
* 24 * 3600 ) {
--
Alexander