equal
deleted
inserted
replaced
63 $path .= "/" unless ( $path =~ /\/$/ ); |
63 $path .= "/" unless ( $path =~ /\/$/ ); |
64 my $dest_path = $path . $source_host; |
64 my $dest_path = $path . $source_host; |
65 |
65 |
66 # create remote destination directory |
66 # create remote destination directory |
67 my $ssh_cmd_args = { |
67 my $ssh_cmd_args = { |
68 user => $username, |
68 user => $username, |
69 host => $dest, |
69 host => $dest, |
70 command => 'mkdir', |
70 command => 'mkdir', |
71 args => [ '-m 0700', "-p $dest_path" ], |
71 args => [ '-m 0700', "-p $dest_path" ], |
72 }; |
72 }; |
73 ssh_cmd $ssh_cmd_args unless $opt_dry_run; |
73 ssh_cmd $ssh_cmd_args unless $opt_dry_run; |
74 |
74 |
75 debug("PROG ssh command: ssh $username\@$dest $ssh_cmd_args->{command} ", join ' ', @{$ssh_cmd_args->{args}}) if $opt_debug; |
75 debug( "PROG ssh command: ssh $username\@$dest $ssh_cmd_args->{command} ", |
|
76 join ' ', @{ $ssh_cmd_args->{args} } ) |
|
77 if $opt_debug; |
76 |
78 |
77 rsync( $username, $dest, $dest_path, $stamp ); |
79 rsync( $username, $dest, $dest_path, $stamp ); |
78 |
80 |
79 } |
81 } |
80 |
82 |
145 |
147 |
146 if ( $pid == 0 ) { |
148 if ( $pid == 0 ) { |
147 open( STDERR, ">&TMP" ) or die "$!"; |
149 open( STDERR, ">&TMP" ) or die "$!"; |
148 open( STDOUT, ">/dev/null" ) unless $opt_verbose; |
150 open( STDOUT, ">/dev/null" ) unless $opt_verbose; |
149 exec @cmd; |
151 exec @cmd; |
150 warn "Failed to exec '", join ' ', @cmd, "': $!\n"; |
152 warn "Failed to exec '", join ' ', @cmd, "': $!\n"; |
151 } |
153 } |
152 else { |
154 else { |
153 waitpid $pid, 0; |
155 waitpid $pid, 0; |
154 } |
156 } |
155 |
157 |
160 open( TMP, "+</tmp/$ME.$$" ) |
162 open( TMP, "+</tmp/$ME.$$" ) |
161 or die "$ME: Can't open /tmp/$ME.$$"; |
163 or die "$ME: Can't open /tmp/$ME.$$"; |
162 unlink "/tmp/$ME.$$"; |
164 unlink "/tmp/$ME.$$"; |
163 |
165 |
164 while (<TMP>) { |
166 while (<TMP>) { |
165 chomp; |
167 chomp; |
166 push @status, "[WARNING] $_" |
168 push @status, "[WARNING] $_" |
167 unless $opt_keepgoing and !$opt_dry_run; |
169 unless $opt_keepgoing and !$opt_dry_run; |
168 } |
170 } |
169 close(TMP); |
171 close(TMP); |
170 } |
172 } |
171 |
173 |
172 if (@status) { |
174 if (@status) { |