In a directory I have several folders and I want to send just the sapdata1 to sapdata14 folders and their contents but not sapdataXX/.snapshot
the script is:
#!/bin/bash
# SETUP OPTIONS
export SRCDIR="/scratch/doug/test/sapdata*"
export FSRCDIR="/scratch/doug/test"
export DESTDIR="fred@111.222.333.444:/sendtest/TST"
export THREADS="40"
echo "Starting... "
date
# RSYNC DIRECTORY STRUCTURE
rsync -zvr -f"- *sapdata*/.snapshot" -f"+ */" -f"- *" ${SRCDIR} ${DESTDIR} \
# FIND ALL FILES AND PASS THEM TO MULTIPLE RSYNC PROCESSES
cd $FSRCDIR && find sapdata* -path "sapdata*/.snapshot" -prune -o ! -type d -print0 | xargs -0 -n1 -P${THREADS} -I% rsync -arvh --partial --size-only % ${DESTDIR}/%
echo "Complete"
date
The first rsync seems to work, I can see all the folders at the destination.
The find works and finds just over 600 files, however the xargs command only seems to send 40 files and then stops, I thought the -P would spawn 40 processes at a time until all the files were sent . I'm probably missing something obvious but I just can't figure it out.
I should also mention that I'm sending about 15Tb worth of large files. Hence the send in parallel script.
Thanks for testing. I've also tried running the script just copying files locally and it seems to work ok. The issue only seems to be with sending to the remote server.
It could be some sort of resource issue, or connection limit. I'd try less threads.
With disk and network I/O bottlenecks involved, I find it hard to believe that 40 threads would be quicker than 5, on my low spec system here 5 takes about twice as long as 1!