Feature request(v3, v4). Add non fatal errors notifications to BackupPC_sendEmail.

Alexander Moisseev <[email protected]> Fri, 10 Jan 2014 11:29:41 +0400
Newsgroups gmane.comp.sysutils.backup.backuppc.devel
Message-ID <[email protected]>
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

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
BackupPC-devel mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/