parallel: Use && to make sure dest dir is created before trying to rsync to it.

This commit is contained in:
Ole Tange 2016-08-03 23:55:54 +02:00
parent 201eab34ab
commit b9470f8964

View file

@ -4229,7 +4229,7 @@ sub usleep {
# Input: # Input:
# $ms = milliseconds to sleep # $ms = milliseconds to sleep
my $ms = shift; my $ms = shift;
::debug(int($ms),"ms "); ::debug("timing",int($ms),"ms ");
select(undef, undef, undef, $ms/1000); select(undef, undef, undef, $ms/1000);
} }
@ -5984,8 +5984,8 @@ sub rsync_transfer_cmd {
my $rsync_opt = "-rlDzR -e" . ::shell_quote_scalar($sshcmd); my $rsync_opt = "-rlDzR -e" . ::shell_quote_scalar($sshcmd);
my $serverlogin = $self->serverlogin(); my $serverlogin = $self->serverlogin();
# Make dir if it does not exist # Make dir if it does not exist
return "( $sshcmd $serverlogin -- mkdir -p $rsync_destdir;" . return "$sshcmd $serverlogin -- mkdir -p $rsync_destdir && " .
rsync()." $rsync_opt $file $serverlogin:$rsync_destdir )"; rsync()." $rsync_opt $file $serverlogin:$rsync_destdir";
} }
sub cleanup_cmd { sub cleanup_cmd {
@ -6022,7 +6022,7 @@ sub cleanup_cmd {
$f = ::shell_quote_file($f); $f = ::shell_quote_file($f);
my $sshcmd = $self->sshcommand(); my $sshcmd = $self->sshcommand();
my $serverlogin = $self->serverlogin(); my $serverlogin = $self->serverlogin();
return "$sshcmd $serverlogin -- ".::shell_quote_scalar("(rm -f $f; $rmdir)"); return "$sshcmd $serverlogin -- ".::shell_quote_scalar("rm -f $f; $rmdir");
} }
{ {
@ -7416,7 +7416,7 @@ sub sshreturn {
# mkdir -p /home/tange/dir/subdir/; # mkdir -p /home/tange/dir/subdir/;
# rsync (--protocol 30) -rlDzR --rsync-path="cd /home/tange/dir/subdir/; rsync" # rsync (--protocol 30) -rlDzR --rsync-path="cd /home/tange/dir/subdir/; rsync"
# server:file.gz /home/tange/dir/subdir/ # server:file.gz /home/tange/dir/subdir/
$pre .= "mkdir -p $basedir$cd; ".$sshlogin->rsync()." $rsync_cd $rsync_opt $serverlogin:". $pre .= "mkdir -p $basedir$cd && ".$sshlogin->rsync()." $rsync_cd $rsync_opt $serverlogin:".
$basename . " ".$basedir.$cd.";"; $basename . " ".$basedir.$cd.";";
} }
return $pre; return $pre;