* Added multi-level incrementals. Still needs testing.
[BackupPC.git] / bin / BackupPC_sendEmail
index 3a1200d..3f82313 100755 (executable)
@@ -31,7 +31,7 @@
 #
 #========================================================================
 #
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -46,10 +46,11 @@ use BackupPC::FileZIO;
 use Data::Dumper;
 use Getopt::Std;
 use DirHandle ();
-use vars qw($Lang $TopDir $BinDir %Conf);
+use vars qw($Lang $TopDir $BinDir $LogDir %Conf);
 
 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
 $TopDir = $bpc->TopDir();
+$LogDir = $bpc->LogDir();
 $BinDir = $bpc->BinDir();
 %Conf   = $bpc->Conf();
 $Lang   = $bpc->Lang();
@@ -57,7 +58,7 @@ $Lang   = $bpc->Lang();
 $bpc->ChildInit();
 
 use vars qw(%UserEmailInfo);
-do "$TopDir/log/UserEmailInfo.pl";
+do "$LogDir/UserEmailInfo.pl";
 
 my %opts;
 if ( !getopts("t", \%opts) || @ARGV != 0 ) {
@@ -193,6 +194,11 @@ foreach my $host ( sort(keys(%Status)) ) {
     my $numBadOutlook = 0;
     for ( my $i = 0 ; $i < @Backups ; $i++ ) {
         my $fh;
+        #
+        # ignore partials -> only fulls and incrs should be used
+        # in figuring out when the last good backup was
+        #
+        next if ( $Backups[$i]{type} eq "partial" );
         $lastNum = $Backups[$i]{num} if ( $lastNum < $Backups[$i]{num} );
         if ( $Backups[$i]{type} eq "full" ) {
             $lastFull = $Backups[$i]{startTime}
@@ -286,7 +292,7 @@ if ( !$opts{t} ) {
     my $dumpStr = Data::Dumper->Dump(
              [\%UserEmailInfo],
              [qw(*UserEmailInfo)]);
-    if ( open(HOST, ">", "$TopDir/log/UserEmailInfo.pl") ) {
+    if ( open(HOST, ">", "$LogDir/UserEmailInfo.pl") ) {
        binmode(HOST);
         print(HOST $dumpStr);
         close(HOST);