pssh: Execute a command on multiple hosts on terminal

If you deal with the task of manage multiple machines in a local network, it is usual need to apply a given settings over all hosts, or install a new program on the entire network. We’ve posted before a tool called cluster-ssh which hold it via interface (or exporting X). However, if you could not export X you can use pssh, a tool that dispatch a command to multiple hosts in terminal. It can be found on Ubuntu repositories, but in Karmic Koala it does not work. The installation completes, but it does not create the binary in /bin, /usr/bin neither in /usr/local/bin). The turnaround is presented below:

sudo add-apt-repository ppa:thelupine/ppa
sudo apt-get update
sudo apt-get install pssh

After installing it, you can check, for instance, who is accessing each machine, what’s the load on each machine, what are the mounted devices and so. First you need to create a file with a list of all hosts:

### hosts.txt ### 
server1
server2
server3
server4

Then you can dispatch the command to be distributed:

pssh -h hosts.txt -i "df -h"

Read more:
http://www.thelupine.com/content/pssh-parallel-ssh

See ya

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: