On Mon, 2001-12-03 at 15:02, Jim Crumley wrote:
> 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?
> >
> 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 &";
> }
or
#!/bin/tcsh
HOSTS="hosta, hostb"
foreach ${HOSTS} ; uname -a ; echo $1 ; ssh -x $1 ; end
:-)
--
Ben Lutgens
Sistina Software Inc.
Kernel panic: I have no root and I want to scream
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20011203/d360bbb2/attachment.pgp