Execute the same command on multiple Linux host in once

I found difficult to maintain updates over multiple hosts however, some tool exist to facilitate that time of maintenance steps.

Alternatively, some python script could also be used however I have decided to present that one for now.

pssh

On Centos/Redhat:

yum install python-pip

On Debian based:

apt-get install python-pip

prepare your list of hosts  IP with the port (SSH is 22) which you require to run the same command, and run this as example:

192.168.1.50:22
192.168.1.51:22

Then you can run this as command:

pssh -h hosts -l pi -A -i "sudo uptime"

 

Leave a Reply

Your email address will not be published. Required fields are marked *