How to run one script remotely on several hosts

74 views Asked by At

I have some hosts in my ~/.ssh/config Some of them are in ./my.nodes file

I want to run script (./myscript.sh) on hosts which are listed in my.nodes.

I can do this using next command:

parallel --sshloginfile ./my.nodes --bf ./myscript.sh ::: ./myscript.sh ./myscript.sh 

This command will run script only 2 nodes. If I want to run it on N nodes, I should repeat 'myscript.sh' at the end of this command N times.

Is it possible to run script on all nodes from file ./my.nodes without repeating 'myscript.sh' at the end of command?

1

There are 1 answers

0
Dario On

Yes, it is.

parallel --nonall --sshloginfile ./my.nodes --bf ./myscript.sh ./myscript.sh 

Please notice that --nonall is a bit misleading... it means --onall with no arguments.