Hi Vaclav. Please use [email protected] for support unless you want to hire me as consultant.
On Mon, Aug 12, 2013 at 4:33 PM, <[email protected]> wrote: > > Hello Ole, > I would like to ask you for help with parallel move and encrypt script. > I have found you perfect GNU parallel and I would like to use it in my > script. Sounds good. If you like GNU Parallel: * Give a demo at your local user group/team/colleagues * Post the intro videos on Reddit/Diaspora*/forums/blogs/ Identi.ca/Google+/Twitter/Facebook/Linkedin/mailing lists * Request or write a review for your favourite blog or magazine * Invite me for your next conference If you use GNU Parallel for research: * Please cite GNU Parallel in you publications (use --bibtex) If GNU Parallel saves you money: * (Have your company) donate to FSF https://my.fsf.org/donate/ > On my server is program that is generating 500 MB files every 20 seconds. > I would like to move this files to another directory, encrypt them and than > delete not encrypted files. > > I have used your parallel --semaphor script for encrypting in loop > > #!/bin/bash > for i in `ls file*.testdata`; do > echo $i > sem -j+0 'gpg -e -r testing; echo ' $i; > #rm $i > done > sem --wait > > but now I don't know ho to implement move and deleting in same script to be > effective > Could you please help me with this ? > > Thanks > > Regards > > Vaclav Something like this ought to work: parallel 'gpg -e -r testing {} && rm {} && mv {}.gpg done_dir/ && echo Done {}' ::: file*.testdata If you prefer a bash function: process_file() { echo Processing $1 gpg -e -r testing $1 \ && rm $1 \ && mv $1.gpg done_dir/ \ && echo $1 processed succesfully \ || echo $1 failed } export -f process_file parallel process_file ::: file*.testdata /Ole
