use tmp file for stor
authorHeiko Schlittermann (CTQ) <hs@schlittermann.de>
Mon, 01 Aug 2011 15:40:43 +0200
changeset 122 51a8543685bb
parent 121 7234011fd0e6
child 123 0c6e454093df
use tmp file for stor
bin/ftbackup
--- a/bin/ftbackup	Mon Aug 01 15:19:08 2011 +0200
+++ b/bin/ftbackup	Mon Aug 01 15:40:43 2011 +0200
@@ -238,7 +238,7 @@
 
             # we can do a snapshot
             # FIXME: check the snapshot name is not used already
-            my $snap = "$dev->{lvm}{path}-snap." . time;
+            my $snap = "$dev->{lvm}{path}-snap.$^T";
 
             verbose "Creating snapshot $snap\n";
             system($_ =
@@ -322,8 +322,9 @@
         };
 
         if ($ftp) {
-            verbose("sending dump to " . $ftp->pwd . "/$file\n");
+            verbose("sending dump to " . $ftp->pwd . "/$file.tmp-$^T\n");
             $ftp->try(put => $dump, $file);
+	    $ftp->try(rename => "$file.tmp-$^T", $file);
         }
         else {
             print while <$dump>;
@@ -695,7 +696,7 @@
         next if $o{dry};
         $ftp->delete($_->{file});
     }
-exit 0;
+
 }
 
 #/dev/vda1 0 Thu Apr 14 12:54:31 2011 +0200