On Mon, Dec 03, 2001 at 02:18:18PM -0600, Austad, Jay wrote:
> Does anyone have a good solution for executing the same command to multiple
> boxes?
> 
> I have a cluster of mailservers, and when I do things on one, I frequently
> need to do them across all of them.  Ssh'ing into each box is too time
> consuming.

Write a script to ssh to multiple boxes.  Here's a simple perl
script to do it. I call it grun - to use it just type 
'grun command_to_run_on_all_machines' 

#!/usr/local/bin/perl
# run input command on all machines.

@machine_list=("mach1", "mach2", "mach3");
# Will run commandline parameters as a command on each machine.
# uname added to help separate output from different machines.
$command= "uname -n; @ARGV";

foreach $machine (@machine_list) {
  print "ssh $machine $command &\n";
  system "ssh $machine $command  &";
}



-- 
Jim Crumley                  |Twin Cities Linux Users Group Mailing List (TCLUG)
crumley at fields.space.umn.edu |Minneapolis/St. Paul, Minnesota 
Ruthless Debian Zealot       |http://www.mn-linux.org/ 
Never laugh at live dragons  |Free Dmitry Sklyarov - http://faircopyright.org/