Re: Simple Script <- correct subject this time, sorry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oops...sorry

---------- Forwarded message ----------
From: Andrew Mather <mathera@xxxxxxxxx>
Date: Mar 14, 2006 11:19 AM
Subject: Re: fedora-list Digest, Vol 25, Issue 127
To: fedora-list@xxxxxxxxxx, maccy@xxxxxxxxxxxxxx

Does anyone have a simple perl or shell script that will run a set of commands
on a number of machines?
For example install a perl cpan module on 50 machines, listed in a file.

What you're asking is not a trivial thing to do in a robust and reliable way !

This is the sort of thing you need to do if you're managing a cluster for example.

For my cluster, I use pdsh, which is a public-domain version of the dsh utility that IBM ship with their CSM suite.  I've aliased it to dsh, because I was used to that ;-)

You can get it from here:  http://www.llnl.gov/linux/pdsh/

You'll also need the genders library to define groups of machines (eg all FC4 machines, all FC5 machines).  You can get that from here: http://www.llnl.gov/linux/genders/

This will all take a bit of setting up, however once it's up and working, it's a VERY powerful way to manage a heap of machines from a single node.

Once it's working, you can issue a command like: pdsh -a rpm -i somerpm.rpm  This will install somerpm.rpm on all machines, or:  pdsh -g fc4 shutdown -r now which would reboot all the machines in the fc4 group.

It also comes with a very handy utility called dshbak.  With this, you can run a command on any number of machines and it will collate the output, grouping all identical outputs into one and listing the machines.

For example, pdsh -a `date` |dshbak -c would group together all machines which return identical times.

Other than that, you'd have to set up passwordless login for ssh on every node, list them all in a file and then use something like

for node in `cat mynodes.txt`
  do
     ssh -c $node do_something
 done

This would (probably) work, but it would be pretty fragile.

HTH


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux