Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm just wondering if there is any fellow sysadmin with the need to execute one command on multiple servers. If so, what technique are you using?

I have grown tired to ssh-ing to 3-5 servers and executing the same thing over and over again, so I'm thinking to make my life easier.
Also, I think I should create keys so I don't have to enter passwords anymore (though I'm using root). After 2 years of doing this, I kind of developed a laziness.

I googled it up, I know about cssh, pssh, tentakel (this one seems cool), and the more pro-genre - Puppet (of which I just heard of, didn't invest the time to read the docs).

BTW, I'm using XP+putty, so if there is any putty-cool-thingy available, that's welcome too. If not, I can always ssh to one server and from there start my rest-of-the-servers-conquest :) *evil*

Hit me up. Thanks.

share|improve this question
1  
Ever heard of a batch file? –  John Gardeniers May 20 '10 at 13:51
    
that's not quite a great idea. –  w00t May 21 '10 at 7:01
    
What are you executing? How do you know it worked or had the expected result on all the servers without actually going through them one-by-one or introducing an actual management system? Things sometimes sound a bit complex for a reason (though more often for no good reason) ^^ –  Oskar Duveborn Aug 11 '10 at 14:59

6 Answers 6

up vote 8 down vote accepted

Look at:
clusterssh

share|improve this answer
    
I'm on xp so I can't use clusterssh –  w00t May 21 '10 at 8:16
    
I suppose it can be done via Cygwin. –  Casual Coder May 21 '10 at 9:02
    
i just searched it and it doesn't seem to be a way. i found puttycm which is for $indows, but it needs many improvements. clusterssh would had been great, indeed. –  w00t May 21 '10 at 13:48
    
from sourceforge.net/apps/mediawiki/clusterssh/… : "It should work on any POSIX compliant UNIX style OS, i.e. cygwin" also google search gives -> jon.limedaley.com/plog/post/installing-clusterssh-on-cygwin –  Casual Coder May 21 '10 at 16:53
    
Hehe, I've managed to do it. Thanks! –  w00t May 25 '10 at 13:59

Have a look at:

http://www.millardsoftware.com/puttycs

It is a wrapper around PuTTy that performs a similar function to Cluster SSH.

share|improve this answer
    
I'm using puttycs myself. To help in opening multiple windows at once, I also found ntsend.freeserve.co.uk/puttymenu.html –  Alister Bulman Aug 4 '11 at 9:55

dssh or pssh may provide you with what you need.

share|improve this answer
    
Just tried pssh, it's even available by default as a package in Ubuntu (although the command is called parallel-ssh there). Works perfectly! –  Wim Sep 3 '11 at 12:44
    
Happy to hear it! –  gWaldo Sep 3 '11 at 13:50

If you're a Ruby person then Capistrano is worth considering. If you're keen on the idea of Puppet then cfengine and bcfg2 are also worth taking a look at.

I'm really liking Capistrano for regular tasks, though I'm not sure I'm using it very well and I'd probably benefit from some training. For more one-off tasks I'd recommend clusterssh.

share|improve this answer
    
capistrano looks kind of complex :( –  w00t May 21 '10 at 8:20

If you have ssh keys setup and installed and want something simple:

#!/bin/bash
SRVLST="server1 server2"

for SRV in $SRVLST
do
    echo Logging into root\@$SRV
    ssh root@$SRV "$1"
done

However if you really want to controll things properly you should look at a utility such as Puppet

share|improve this answer
1  
cssh and dsh do this better –  ptman May 20 '10 at 9:03
    
there are likely many many better ways to do this; it's a simple option nothing more. The preference would be to implement a system to actually control them along the lines of Puppet as mentioned in the question. –  Antitribu May 20 '10 at 9:06
    
Actually I do have a script in bash that does this for my apache-cluster: read answ com=`ssh web2 "$answ"` echo "$com" but I want to try something more efficient. –  w00t May 20 '10 at 9:52

If you need just to execute the same commands on a set of servers, then I would suggest clusterssh: I use it routinely and it works very well.

share|improve this answer
    
don't i need x-server for cluster ssh? –  w00t May 21 '10 at 8:20
    
Yes, clusterssh needs an X server, I use it on Windows boxes with Cygwin's X-Server. –  sebastianopilla May 21 '10 at 17:59
1  
@sebastianopilla how many servers do you open in one session? do you have more than 10? I have two LCDs but I cannot resize the cygwin window, so I'm basically stuck to one LCD's size (17", 1280x1024) and if I want to open more sessions I cannot cram them up in there. Can you resize? –  w00t Jun 18 '10 at 12:42
    
@woot, the maximum I've done is 6, on my setup (26" main screen, 17" secondary screen) it was quite usable. I've just tried it again, and I was able to freely resize all of windows; if it doesn't work for you then there might be some issue with your Cygwin/X setup, or with clusterssh's .csshrc file. –  sebastianopilla Jun 20 '10 at 20:35
    
@sebastianopilla I was referring to the cygwin window itself, not the other windows contained in it. So the one that it is displayed in your Taskbar, can you resize that one? –  w00t Jun 22 '10 at 9:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.