2
I have a script that rsync's files over in parallel using xargs and rsync daemon mode. I occasionally get errors with rsync due to writes happening on the source. I want to be able to retry the rsync if there are any errors. I thought this would work, but having a semi-colon seems to break it. Is there another way to do this?
find ./path -mindepth 1 -maxdepth 1 -type d | xargs -r -t -n 1 -P 4 -I % until rsync -am %/ $host::%/; do echo "TRY AGAIN"; done
./rsync_retry.sh: line 21: syntax error near unexpected token `do'
What's the test condition you're trying to check for? You want xargs to run an until loop on every file? Should until not be first line? – Xen2050 – 2015-12-15T06:59:29.760
So in
./path
are a bunch of directories, and rsync will be syncing each of those directories over. Sometimes, a few of the files inside of those directories fails to copy and in those cases I want the rsync for that directory to retry. – minhaz1 – 2015-12-15T21:12:05.4031
xargs
is a horrible broken program. Just say no. GNUparallel
is a large improvement. For anything too complicated for that you should use a different language that actually supports concurrency. See UsingFind for how to not suck atfind
. – ormaaj – 2015-12-16T17:20:47.543