BackupPC-users

Re: [BackupPC-users] JmBeuken

2008-06-21 16:44:33
Subject: Re: [BackupPC-users] JmBeuken
From: nadia kheffache <nadiakheffache AT yahoo DOT fr>
To: Jean-Michel Beuken <jean-michel.beuken AT uclouvain DOT be>
Date: Sat, 21 Jun 2008 20:44:17 +0000 (GMT)
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 <jean-michel.beuken AT uclouvain DOT be> a écrit :
De: Jean-Michel Beuken <jean-michel.beuken AT uclouvain DOT be>
Objet: Re: [BackupPC-users] JmBeuken
À: "nadia kheffache" <nadiakheffache AT yahoo DOT fr>
Cc: "backuppc-users" <backuppc-users AT lists.sourceforge DOT net>
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 = "xxxx\@domain";
$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: xxx\@domain\n";
print MAIL "Reply-to: yyyy\@domain\n";
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:xxx\@domain\n";
close (MAIL);
};
}


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
-------------------------------------------------------------------------
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
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
<Prev in Thread] Current Thread [Next in Thread>