From b9470f8964240da9956f6541955d36a38fd104f8 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 3 Aug 2016 23:55:54 +0200 Subject: [PATCH] parallel: Use && to make sure dest dir is created before trying to rsync to it. --- src/parallel | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parallel b/src/parallel index 42db67be..5312ddfa 100755 --- a/src/parallel +++ b/src/parallel @@ -4229,7 +4229,7 @@ sub usleep { # Input: # $ms = milliseconds to sleep my $ms = shift; - ::debug(int($ms),"ms "); + ::debug("timing",int($ms),"ms "); select(undef, undef, undef, $ms/1000); } @@ -5984,8 +5984,8 @@ sub rsync_transfer_cmd { my $rsync_opt = "-rlDzR -e" . ::shell_quote_scalar($sshcmd); my $serverlogin = $self->serverlogin(); # Make dir if it does not exist - return "( $sshcmd $serverlogin -- mkdir -p $rsync_destdir;" . - rsync()." $rsync_opt $file $serverlogin:$rsync_destdir )"; + return "$sshcmd $serverlogin -- mkdir -p $rsync_destdir && " . + rsync()." $rsync_opt $file $serverlogin:$rsync_destdir"; } sub cleanup_cmd { @@ -6022,7 +6022,7 @@ sub cleanup_cmd { $f = ::shell_quote_file($f); my $sshcmd = $self->sshcommand(); 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/; # rsync (--protocol 30) -rlDzR --rsync-path="cd /home/tange/dir/subdir/; rsync" # 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.";"; } return $pre;