start the FTP connectioni later, to avoid silly timeouts
authorHeiko Schlittermann (CTQ.kx.schlittermann.de) <hs@schlittermann.de>
Tue, 03 May 2011 11:50:06 +0200
changeset 85 f6a277e9bda8
parent 68 73e32571b22f
child 86 aa87981ccf8c
start the FTP connectioni later, to avoid silly timeouts
bin/ftbackup
--- a/bin/ftbackup	Mon May 02 14:40:54 2011 +0200
+++ b/bin/ftbackup	Tue May 03 11:50:06 2011 +0200
@@ -118,19 +118,6 @@
 
     my $ftp;
 
-    if (not "output" ~~ \@opt_debug) {
-        $ftp = new FTP(
-            $cf{FTP_HOST},
-            Passive => $cf{FTP_PASSIVE},
-            Debug   => "ftp" ~~ \@opt_debug,
-        ) or die $@;
-        $ftp->login or die $ftp->message;
-        $ftp->home($ftp->try(pwd => ()));
-        $ftp->try(binary => ());
-        $ftp->try(mkpath => $cf{FTP_DIR});
-        $ftp->try(cwd    => $cf{FTP_DIR});
-    }
-
     # get_history the situation - we rely on $opt_dumpdates
     @devs = get_history(@devs);
     @devs = calculate_level($cf{FULL_CYCLE}, @devs);
@@ -173,6 +160,20 @@
         exit;
     }
 
+    if (not "output" ~~ \@opt_debug) {
+        $ftp = new FTP(
+            $cf{FTP_HOST},
+            Passive => $cf{FTP_PASSIVE},
+            Debug   => "ftp" ~~ \@opt_debug,
+        ) or die $@;
+        $ftp->login or die $ftp->message;
+        $ftp->home($ftp->try(pwd => ()));
+        $ftp->try(binary => ());
+        $ftp->try(mkpath => $cf{FTP_DIR});
+        $ftp->try(cwd    => $cf{FTP_DIR});
+    }
+
+
     # and now we can start doing something with our filesystems
   DEVICE: foreach my $dev (@devs) {
         my $dir = $dev->{mountpoint};