reoback.pl

Bash, Shell, PHP, Python, Perl, CGI
user996
Posts: 49
Joined: 2004-08-01 13:23

reoback.pl

Post by user996 » 2005-10-04 22:06

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" );

r00ty
Posts: 747
Joined: 2003-03-17 15:32

Re: reoback.pl

Post by r00ty » 2005-10-04 22:35

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 ;-)
Last edited by r00ty on 2005-10-05 06:38, edited 1 time in total.

user996
Posts: 49
Joined: 2004-08-01 13:23

Re: reoback.pl

Post by user996 » 2005-10-04 22:42

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" );

r00ty
Posts: 747
Joined: 2003-03-17 15:32

Re: reoback.pl

Post by r00ty » 2005-10-05 06:38

ersteres hast du wohl ein paar Zeichen vergessen zu kopieren
zweiteres war wirklich ein Fehler von mir :-)

user996
Posts: 49
Joined: 2004-08-01 13:23

Re: reoback.pl

Post by user996 » 2005-10-05 07:05

und wie muss ich das nun abändern

r00ty
Posts: 747
Joined: 2003-03-17 15:32

Re: reoback.pl

Post by r00ty » 2005-10-06 09:39

ich hab oben mein posting geändert - einfach neu kopieren

kiwikiwi
Posts: 65
Joined: 2003-08-17 09:06

Re: reoback.pl

Post by kiwikiwi » 2005-10-21 02:56

ansonsten suche mal hier im forum es gibt schon was fertigges

r00ty
Posts: 747
Joined: 2003-03-17 15:32

Re: reoback.pl

Post by r00ty » 2005-10-22 08:11

? was suchst du ?