]> git.proxmox.com Git - pve-zsync.git/commitdiff
extend send_config with method local
authorWolfgang Link <w.link@proxmox.com>
Thu, 5 Nov 2015 08:00:30 +0000 (09:00 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 6 Nov 2015 07:22:43 +0000 (08:22 +0100)
what can be used to make local backups

pve-zsync

index caf071274eacb1fc609692df2ae6e96ee49e8f48..705d3117818edeb2936622e8a94413032c9b09ac 100644 (file)
--- a/pve-zsync
+++ b/pve-zsync
@@ -576,8 +576,10 @@ sub sync {
                $source->{last_part} = $disks->{$disk}->{last_part};
                &$sync_path($source, $dest, $job, $param, $date);
            }
-           if ($param->{method} eq "ssh") {
+           if ($param->{method} eq "ssh" && ($source->{ip} || $dest->{ip})) {
                send_config($source, $dest,'ssh');
+           } else {
+               send_config($source, $dest,'local');
            }
        } else {
            &$sync_path($source, $dest, $job, $param, $date);
@@ -733,7 +735,7 @@ sub run_cmd {
 }
 
 sub parse_disks {
-    my ($text, $ip) = @_;
+    my ($text, $ip, $vm_type) = @_;
 
     my $disks;
 
@@ -908,6 +910,9 @@ sub send_config{
                run_cmd(['rm', '-f', '--', $dest_target_old]);
            }
        }
+    } elsif ($method eq 'local') {
+       run_cmd(['mkdir', '-p', '--', $CONFIG_PATH]);
+       run_cmd(['cp', $source_target, $dest_target_new]);
     }
 }