GNU parallel does not work in parallel on remote servers when using --onall

I am trying to run a script on multiple remote servers with multiple parameters. GNU parallel command:

parallel --onall -S ${RH32},{RH64} /shared/loc/script.sh ::: param1 param2

script.sh:

host=`uname -n`
param=$1
logfile=/shared/loc/log-$host-$param
for i in `seq 1 5`; do
    touch ${logfile}_$i
    sleep 2
done

I try to execute 4 processes in parallel:

  • rh32 script.sh with parameter
  • rh32 script.sh with parameter
  • rh64 runs script.sh with the parameter
  • rh64 runs script.sh with parameter2

When viewing the output, when it accumulates, it appears what really happens:

  • rh32 script.sh with parameter
  • rh64 runs script.sh with the parameter

- performed in parallel. When they finish , the other two are executed in parallel.

How can I make all four of them work in parallel at the same time?

Thanks,

+4
source share
1 answer

: -j, - ? , -j - , ( 2). , .

, parallel parallel:

parallel parallel --onall -S ${RH32},${RH64} --argsep // /shared/loc/script.sh // ::: param1 param2

parallel , parallel .

- ssh :

parallel ssh {1} /shared/loc/script.sh {2} ::: ${RH32} ${RH64} ::: param1 param2
+4

All Articles