projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fixed configure.pl and makeDist.
[BackupPC.git]
/
bin
/
BackupPC_sendEmail
diff --git
a/bin/BackupPC_sendEmail
b/bin/BackupPC_sendEmail
index
cf4f627
..
8357bdc
100755
(executable)
--- a/
bin/BackupPC_sendEmail
+++ b/
bin/BackupPC_sendEmail
@@
-31,7
+31,7
@@
#
#========================================================================
#
#
#========================================================================
#
-# Version
2.1.0_CVS, released 8 Feb 2004
.
+# Version
3.0.0alpha, released 23 Jan 2006
.
#
# See http://backuppc.sourceforge.net.
#
#
# See http://backuppc.sourceforge.net.
#
@@
-46,10
+46,11
@@
use BackupPC::FileZIO;
use Data::Dumper;
use Getopt::Std;
use DirHandle ();
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();
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();
$BinDir = $bpc->BinDir();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
@@
-57,7
+58,7
@@
$Lang = $bpc->Lang();
$bpc->ChildInit();
use vars qw(%UserEmailInfo);
$bpc->ChildInit();
use vars qw(%UserEmailInfo);
-do "$
TopDir/log
/UserEmailInfo.pl";
+do "$
LogDir
/UserEmailInfo.pl";
my %opts;
if ( !getopts("t", \%opts) || @ARGV != 0 ) {
my %opts;
if ( !getopts("t", \%opts) || @ARGV != 0 ) {
@@
-82,7
+83,8
@@
my $mesg = "";
my @badHosts = ();
foreach my $host ( sort(keys(%Status)) ) {
my @badHosts = ();
foreach my $host ( sort(keys(%Status)) ) {
- next if ( $Status{$host}{reason} ne "backup failed"
+ next if ( ($Status{$host}{reason} ne "Reason_backup_failed"
+ && $Status{$host}{reason} ne "Reason_restore_failed")
|| $Status{$host}{error} =~ /^lost network connection to host/ );
push(@badHosts, "$host ($Status{$host}{error})");
}
|| $Status{$host}{error} =~ /^lost network connection to host/ );
push(@badHosts, "$host ($Status{$host}{error})");
}
@@
-121,7
+123,7
@@
my @oldDirs = ();
my @files = $d->read;
$d->close;
foreach my $host ( @files ) {
my @files = $d->read;
$d->close;
foreach my $host ( @files ) {
- next if ( $host
eq "." || $host eq ".."
|| defined($Status{$host}) );
+ next if ( $host
=~ /^\./
|| defined($Status{$host}) );
push(@oldDirs, "$TopDir/pc/$host");
}
if ( @oldDirs ) {
push(@oldDirs, "$TopDir/pc/$host");
}
if ( @oldDirs ) {
@@
-139,10
+141,12
@@
EOF
}
if ( $mesg ne "" && $Conf{EMailAdminUserName} ne "" ) {
}
if ( $mesg ne "" && $Conf{EMailAdminUserName} ne "" ) {
+ my $headers = $Conf{EMailHeaders};
+ $headers .= "\n" if ( $headers !~ /\n$/ );
$mesg = <<EOF;
To: $Conf{EMailAdminUserName}
Subject: BackupPC administrative attention needed
$mesg = <<EOF;
To: $Conf{EMailAdminUserName}
Subject: BackupPC administrative attention needed
-
+$headers
${mesg}Regards,
PC Backup Genie
EOF
${mesg}Regards,
PC Backup Genie
EOF
@@
-216,7
+220,7
@@
foreach my $host ( sort(keys(%Status)) ) {
while ( 1 ) {
my $s = $fh->readLine();
last if ( $s eq "" );
while ( 1 ) {
my $s = $fh->readLine();
last if ( $s eq "" );
- if ( $s =~ /^\s*Error reading file.*\.pst :
ERRDOS - ERRlock
/
+ if ( $s =~ /^\s*Error reading file.*\.pst :
(ERRDOS - ERRlock|NT_STATUS_FILE_LOCK_CONFLICT)
/
|| $s =~ /^\s*Error reading file.*\.pst\. Got 0 bytes/ ) {
$badOutlook = 1;
last;
|| $s =~ /^\s*Error reading file.*\.pst\. Got 0 bytes/ ) {
$badOutlook = 1;
last;
@@
-283,7
+287,7
@@
if ( !$opts{t} ) {
my $dumpStr = Data::Dumper->Dump(
[\%UserEmailInfo],
[qw(*UserEmailInfo)]);
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);
binmode(HOST);
print(HOST $dumpStr);
close(HOST);
@@
-302,10
+306,12
@@
sub user2name
sub sendUserEmail
{
my($user, $host, $mesg, $subj, $vars) = @_;
sub sendUserEmail
{
my($user, $host, $mesg, $subj, $vars) = @_;
- $vars->{user} = $user;
- $vars->{host} = $host;
- $vars->{domain} = $Conf{EMailUserDestDomain};
- $vars->{CgiURL} = $Conf{CgiURL};
+ $vars->{user} = $user;
+ $vars->{host} = $host;
+ $vars->{headers} = $Conf{EMailHeaders};
+ $vars->{headers} .= "\n" if ( $vars->{headers} !~ /\n$/ );
+ $vars->{domain} = $Conf{EMailUserDestDomain};
+ $vars->{CgiURL} = $Conf{CgiURL};
$subj =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
$vars->{subj} = $subj;
$mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
$subj =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
$vars->{subj} = $subj;
$mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;