Tuesday, August 31, 2010

Parallel SSH

Well everybody knows what to do with ssh but what if you need to run a pair of commands on multiple servers ?

Login to each server through ssh and running that command will become a funny business. Isn't?

So here is the tool that can serve commands on multiple servers at the same time.


PARALLEL SSH

Installation

http://www.linux.com/archive/feature/151340

http://www.theether.org/pssh/


Operating PSSH

(in Ubuntu)

parallel-ssh -h hostfile.txt -l username -i -o /path_of_log_folder/folder command



where-

* -h indicates to the host file that contains the list of host servers.

* iplist.txt is the host file that contains the IP addresses (with port number for ssh) of the servers on which the command is to be run.

* -l indicates the next string as the username to be logged-in with.
* -i option in the displays the result of the execution on each server.
* -o specifies the path next to it where the output of the operation (log report)is saved in particular text files.

parallel-ssh -h iplist.txt -l root -i -o /home/robert/checklist/webmin rpm -q webmin

This command (rpm -q webmin) will check the version of webmin on all the servers listed in the iplist.txt file by logging-in with username as root and will generate the output of each server in particular files under folder webmin which is located at  /home/robert/checklist/

No comments:

Post a Comment