Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GNU parallel to parallelize script with various arguments

I am interested in running a script in parallel and I've started looking over GNU parallel tool, however I'm having a bit of trouble. My script doSomething takes 3 arguments and I would like to run the script in parallel on different values for the arguments. How can I do this?

I've tried: parallel ./doSomething {1} {2} {3} ::: {0..5} ::: {0..5} ::: {0..5} but it just seems to hang.

Any help would be greatly appreciated, thanks!

like image 640
undefinederrorname Avatar asked Jun 29 '26 21:06

undefinederrorname


1 Answers

Please try:

parallel --gnu echo ./doSomething {1} {2} {3} ::: {0..5} ::: {0..5} ::: {0..5}

If that works as expected, then your command is blocking because ./doSomething behaves differently when called from GNU Parallel than when it is called directly. One of the reasons why that may happen is if ./doSomething depends on having an tty connected.

like image 130
Ole Tange Avatar answered Jul 03 '26 17:07

Ole Tange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!