Page 1 of 1

reoback.pl

Posted: 2005-10-04 22:06
by user996
Bräuchte eure Hilfe bei einer änderung an dem programm reoback.pl und zwar möchtige ich folgende zeile so umschreiben das reoback bei einem nicht erfolgreichen FTP Login versuch nicht die Fehlermeldung "Unable to connect to remote host" ausgibt sondern einen erneuten connection versuch unternimmet:

Code: Select all

    # Login to remote host if necessary
    if ( $config{"remotebackup"} ) {
      if ( $config{"rbackuptype"} eq "FTP" ) {
        $ftp = Net::FTP->new( $config{"remotehost"}, Debug => 0 ) or
          warn ( "  Unable to connect to remote host! : $!n" );
        $ftp->login( $config{"ftpuser"},$config{"ftppasswd"} ) or
          warn ( "  Unable to login to remote host! : $!n" );

Re: reoback.pl

Posted: 2005-10-04 22:35
by r00ty
statt

Code: Select all

   $ftp = Net::FTP->new( $config{"remotehost"}, Debug => 0 ) or
          warn ( "  Unable to connect to remote host! : $!n" ); 
das verwenden:

Code: Select all

my $retry = 0;
do {
  $retry++;
  print "Try to connect #".$retry."n";
  $ftp = Net::FTP->new( $config{"remotehost"}, Debug => 0 );
} while ( (!$ftp) && ($retry < 10) );
if (!$ftp) {
  warn ( "  Unable to connect to remote host! : $!n" );
}
habs mal frei runtergeschrieben, ich hoffe es sind nicht all zu viele Fehler drinnen ;-)

Re: reoback.pl

Posted: 2005-10-04 22:42
by user996
print " Transferring archive: ".$fileName."...";
if ( $config{"rbackuptype"} eq "FTP" ) {
my $retry = 0;
do {
$retry++;
print "Try to connect #".$retry."n";
$ftp = Net::FTP->new( $config{"remotehost"}, Debug
} while ( (!$ftp) && ($retry < 10) );
if (!$ftp) warn ( " Unable to connect to remote host! : $!n" );
$ftp->login( $config{"ftpuser"},$config{"ftppasswd"} ) or
die ( "Unable to login to remote host! : $!n" );
$ftp->binary;
$ftp->mkdir( $remotePath, 1 ); # Create parent directories if necessary
$ftp->cwd( $remotePath ) or
die ( "Unable to change to remote directory! : $!n" );

/etc/reoback/settings.conf
syntax error at /usr/bin/reoback.pl line 224, near "Debug
}"
syntax error at /usr/bin/reoback.pl line 225, near ") warn"
Execution of /usr/bin/reoback.pl aborted due to compilation errors.
} while ( (!$ftp) && ($retry < 10) );
if (!$ftp) warn ( " Unable to connect to remote host! : $!n" );

Re: reoback.pl

Posted: 2005-10-05 06:38
by r00ty
ersteres hast du wohl ein paar Zeichen vergessen zu kopieren
zweiteres war wirklich ein Fehler von mir :-)

Re: reoback.pl

Posted: 2005-10-05 07:05
by user996
und wie muss ich das nun abändern

Re: reoback.pl

Posted: 2005-10-06 09:39
by r00ty
ich hab oben mein posting geändert - einfach neu kopieren

Re: reoback.pl

Posted: 2005-10-21 02:56
by kiwikiwi
ansonsten suche mal hier im forum es gibt schon was fertigges

Re: reoback.pl

Posted: 2005-10-22 08:11
by r00ty
? was suchst du ?