# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1312286922 -7200 # Node ID b843523f19944ed501b24b32ae8492bafd92ee62 # Parent 906b6ba8e5309c1aa543d01b13f1edebd31e9d63 reconnect ftp if connection was lust during fsck diff -r 906b6ba8e530 -r b843523f1994 bin/ftbackup --- a/bin/ftbackup Tue Aug 02 11:28:42 2011 +0200 +++ b/bin/ftbackup Tue Aug 02 14:08:42 2011 +0200 @@ -323,6 +323,20 @@ }; if ($ftp) { + if (!$ftp->cwd("/")) { + $ftp->quit(); + $ftp = new FTP( + $cf{FTP_HOST}, + Passive => $cf{FTP_PASSIVE}, + Debug => $o{debug}, + ) or LOGDIE $@; + $ftp->login or LOGDIE $ftp->message; + $ftp->home($ftp->try(pwd => ())); + $ftp->try(binary => ()); + $ftp->try(mkpath => $cf{FTP_DIR}); + $ftp->try(cwd => "/"); + } + $ftp->try(cwd => $dir); verbose("sending dump to " . $ftp->pwd . "/$file.tmp-$^T\n"); $ftp->try(put => $dump, "$file.tmp-$^T"); $ftp->try(rename => "$file.tmp-$^T", $file); @@ -504,16 +518,16 @@ sub home { my $self = shift; - return $data{ ref $self }{home} = shift if @_; + return $data{ $self }{home} = shift if @_; $self->try( - cwd => exists $data{ ref $self }{home} - ? $data{ ref $self }{home} + cwd => exists $data{ $self }{home} + ? $data{ $self }{home} : "/" ); return $self->pwd(); } - sub get_home { return $data{ ref shift }{home} } + sub get_home { return $data{ shift() }{home} } } sub update_devnames($$$) {