Reputation: 309
How to execute a command remotely on N systems in parallel via shell script? The command is yum -y update
Upvotes: 0
Views: 86
Reputation: 33685
GNU Parallel has a function for that:
N=10
parallel -j$N --nonall -S server1,server2,server3 yum -y update
The servers can also be read from a file:
N=10
parallel -j$N --nonall --slf hostfile yum -y update
Upvotes: 1
Reputation: 130
You can give a try to Cluster SSH. It´s a simple way to execute the same things in a number of machines. Follow the link to view a tutorial.
Upvotes: 0
Reputation: 4952
Basically I will do that:
for SRV in srv1 srv2 srv3
do
ssh ${SRV} "yum -y update" &
done
wait
It will start the command on each servers and wait for everything to finish.
You should consider to add the different srv
in your .ssh/config
and use a public key authentication on each servers.
Upvotes: 1