--- 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($$$) {