[Avcheck] Patch for AvpUpdate.pl
Ralf Hildebrandt
Ralf.Hildebrandt@charite.de
Fri, 15 Mar 2002 13:12:36 +0100
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi!
I made a little patch to AvpUpdate.pl: With it, it's possible to
specify a list of Servers to try an update from.
--
Ralf Hildebrandt (Im Auftrag des Referat V A) Ralf.Hildebrandt@charite.de
Charite Campus Virchow-Klinikum Tel. +49 (0)30-450 570-155
Referat V A - Kommunikationsnetze - Fax. +49 (0)30-450 570-916
"All programmers are playwrights and all computers are lousy actors." -Anon.
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="AvpUpdate.patch"
--- AvpUpdate.pl.orig Fri Mar 15 12:58:35 2002
+++ AvpUpdate.pl Fri Mar 15 13:08:53 2002
@@ -18,9 +18,7 @@
# --------- This is config -------------
-$UpdateServer = "downloads1.kaspersky-labs.com";
-$UpdateServer = "updates3.kaspersky-labs.com";
-$UpdateServer = "downloads-us1.kaspersky-labs.com";
+@UpdateServers = ("downloads1.kaspersky-labs.com", "downloads-us1.kaspersky-labs.com", "updates3.kaspersky-labs.com");
$UpdateDir = "/updates"; # Directory on support server with avp.set & *.avc files
$UpdateUser = "anonymous"; # ftp username, my be "anonimous"
@@ -36,7 +34,7 @@
$UpdateExec = "/var/spool/avp/restart_kavdaemon";
# Exec this program after update database
-$UpdateVerbose = 0;
+$UpdateVerbose = 1;
$CaseFileName = upper; # Case of database file names (upper or lower)
@@ -68,7 +66,9 @@
my $ftp;
my $try = $UpdateTryConnect;
my $lasterr = "";
+my $ServerIndex = 0;
while( $try >= 0 ) {
+ $UpdateServer = @UpdateServers[$ServerIndex];
print "Trying connect to \'$UpdateServer\'..." if( $UpdateVerbose );
if(( $ftp = Net::FTP->new( $UpdateServer, Passive => $PassiveMode )) ne "" ) {
print " ok.\n" if( $UpdateVerbose );
@@ -80,6 +80,11 @@
} else {
print " failed.\n" if( $UpdateVerbose );
$lasterr = "Login failed on \'$UpdateServer\'";
+ if ($ServerIndex < $#UpdateServers) {
+ $ServerIndex++;
+ } else {
+ $ServerIndex = 0;
+ }
}
$ftp->quit;
} else {
--CE+1k2dSO48ffgeK--