I'm running something like this:
find . -maxdepth 1 -type f -note -iname "*.gpg" | sort | while read file ; do
echo "Encrypting $file..."
gpg --trust-model always --recipient "me@myself.com" --output "$file.gpg" \
--encrypt "$file" && rm "$file"
done
This runs great, but it seems that GPG is not optimized to use multiple cores for an encryption operation. The files I'm encrypting are about 2GB in size and I have quite a bit of them. I'd like to be able to run X jobs in parallel to encrypt the files and then remove them. How can I do this, setting a limit to, say, 8 jobs at a time?
sudooutside of thefind? Make it asudo -i find ... I don't think you can pipe tosudoin that manner. You could do this:echo "cmd1" | sudo bash. – slm Jun 24 '13 at 18:20parallelfor my Fedora system. – slm Jun 24 '13 at 18:34gpg: can't open \': No such file or directory. What the heck? It seems that it's not replacing the{}`. – Naftuli Kay Jun 24 '13 at 18:36--semaphore. – Naftuli Kay Jun 24 '13 at 18:37find . | parallel -j 8 --workdir $PWD 'echo {}; echo {}'. – slm Jun 24 '13 at 18:38