问题
I have a file called macse.cmd which contains 1000 commands to execute, 1 command per line.
I want to use parallel to execute 30 at a time. I don't care in what order they are executed as long as all are.
I tried "parallel -j 30 ./macse.cmd" but this caused them to run 1 by 1 and I am not even sure how to stop them.
Adrian
p.s.
Commands look like:
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_2100035271/all_unaligned.fasta -out_NT M715_2100035271/aligned_nt.fasta -out_AA M715_2100035271/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_100078281/all_unaligned.fasta -out_NT M715_100078281/aligned_nt.fasta -out_AA M715_100078281/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_510001221/all_unaligned.fasta -out_NT M715_510001221/aligned_nt.fasta -out_AA M715_510001221/aligned_aa.fasta
java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq M715_100094159/all_unaligned.fasta -out_NT M715_100094159/aligned_nt.fasta -out_AA M715_100094159/aligned_aa.fasta
So it's only the M715_ number that changes between commands.
回答1:
Is the command always the same? As in
echo "A"
echo "B"
echo "C"
?
Then you should change it to:
"A"
"B"
"C"
and run: parallel -j 30 -a macse.cmd echo
where of course echo
is your actuall command.
回答2:
parallel -j 30 < ./macse.cmd
or:
parallel java -jar -Xmx5000m ~/programs/macse_v1.01b.jar -prog alignSequences -seq {}/all_unaligned.fasta -out_NT {}/aligned_nt.fasta -out_AA {}/aligned_aa.fasta ::: M*/
Walk through the tutorial:
man parallel_tutorial
来源:https://stackoverflow.com/questions/28072857/s-gnu-parallel-execution-of-commands-from-file-few-at-a-time