<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Does anyone have a simple perl or shell script that will run a set of commands<br>on a number of machines?
</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">For example install a perl cpan module on 50 machines, listed in a file.<br><br>

</blockquote><div>What you're asking is not a trivial thing to do in a robust and reliable way !<br>

<br>
This is the sort of thing you need to do if you're managing a cluster for example.<br>
<br>
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 ;-)<br>
<br>
You can get it from here:  <a href="http://www.llnl.gov/linux/pdsh/">http://www.llnl.gov/linux/pdsh/</a><br>
<br>
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:
<a href="http://www.llnl.gov/linux/genders/">http://www.llnl.gov/linux/genders/</a><br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
For example, pdsh -a `date` |dshbak -c would group together all machines which return identical times.<br>
<br>
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<br>
<br>
for node in `cat mynodes.txt`<br>
  do<br>
     ssh -c $node do_something<br>
 done<br>
<br>
This would (probably) work, but it would be pretty fragile.<br>
<br>
HTH<br>
<br>
</div></div>