Dear Jean-Michel,
Please, can you send me the last version of perl script 'analyse_backups?
I have integrated the script BackupNotify, but i have another errors when i
do: perl backupNotify,
regards
Nadia
--- En date de : Mar 17.6.08, Jean-Michel Beuken <[EMAIL PROTECTED]> a écrit :
De: Jean-Michel Beuken <[EMAIL PROTECTED]>
Objet: Re: [BackupPC-users] JmBeuken
À: "nadia kheffache" <[EMAIL PROTECTED]>
Cc: "backuppc-users" <[email protected]>
Date: Mardi 17 Juin 2008, 10h18
Dear Nadia,
I don't known where you find the script and which version it is but the
first line of the script contains the path of the perl command
of course, it depends of your system and you must adapt the path
the last version is below and you can see the first line
#!/usr/bin/perl ( on Linux system )
regards
jmb
------------------------------------------
#!/usr/bin/perl
#################
#
# BackupNotify : send mail after a good or a bad backup
# BackupNotify_succes : send email only after a good backup
# BackupNotify_echec : send email only after a bad backup
#
# jmb 20/06/2006
# jmb 10/10/2007
#
# parameters : $user $xferOK $host $type $client $hostIP
#
use Socket;
$mailprog = '/usr/sbin/sendmail';
$user = $ARGV[0];
$xferOK = $ARGV[1];
$host = $ARGV[2];
$type = $ARGV[3];
$client = $ARGV[4];
$hostIP = $ARGV[5];
$recipient = $user;
$script = $0;
$succes = 1;
$echec = 1;
if ($script =~ 'succes'){ $echec = 0; }
if ($script =~ 'echec'){ $succes = 0; }
## print "$succes,$echec\n";
#
# extract only errors from XferLOG
#
my $status=`/usr/local/BackupPC/bin/analyse_backups $client`;
($xferErr,$badFile,$TopDir,$xferlognum) = split(/-/,$status);
chop($xferlognum);
$xferErr = int($xferErr);
$xferlognum = int($xferlognum);
my $list_error=`/usr/local/BackupPC/bin/BackupPC_zcat
$TopDir/pc/$client/XferLOG.$xferlognum.z | grep NT_STATUS_ACCESS_DENIED
| grep -v 'System Volume Information' | grep -v RECYCLER |grep -v
Watson`;
#
#
$msg = "Rapport de sauvegarde de BackupPC pour le PC \"$client
($hostIP)\" : \n\n";
if ( $xferOK) {
if ( length($list_error) > 0) {
$msg .= "Le backup ($type) s'est PRESQUE bien
deroule...\n\n";
$msg .= "Des erreurs de transfert se sont
produites...\n\n";
$msg .= "Voici la liste des erreurs :\n";
$msg .= "$list_error\n";
$msg .= "Ceci peut se produire dans les situations suivantes
:\n";
$msg .= " - lorsqu'un fichier est en cours
d'utilisation\n";
$msg .= " - lorsqu'un dossier/fichier a des droits
d'acces
trop restrictifs\n\n";
$msg .= "De toute facon, les gestionnaires sont
prevenus...\n";
#print $msg;
$ccrecipient = "[EMAIL PROTECTED]";
$subject = "Backup de $client : ok MAIS... !";
if ( $succes ){ &sendmail($msg); };
} else {
$msg .= "Le backup ($type) s'est bien deroule\n";
$ccrecipient = "";
$subject = "Backup de $client : OK !";
if ( $succes ){ &sendmail($msg); };
}
} else {
$msg .= "Le backup ($type) a pose probleme ! \n";
$subject = "Probleme de backup de $client...";
if ( $echec ) { &sendmail($msg); };
}
# print $msg;
sub sendmail {
my($msg) = @_;
open(MAIL, "|$mailprog -t") && do {
print MAIL "To: $recipient\n";
print MAIL "From: [EMAIL PROTECTED]";
print MAIL "Reply-to: [EMAIL PROTECTED]";
print MAIL "Cc: $ccrecipient\n";
# print MAIL "Bcc:\n";
print MAIL "Subject: $subject \n\n";
print MAIL "$msg\n";
print MAIL "\nVisiter regulierement le site
<http://www.uclouvain.be/backuppc>\n";
print MAIL "\nContact support :
mailto:[EMAIL PROTECTED]";
close (MAIL);
};
}
_____________________________________________________________________________
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
BackupPC-users mailing list
[email protected]
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/