Rob van der Heij wrote:
On 2/22/07, John Summerfield <[EMAIL PROTECTED]> wrote:
If you want to do the same to several hosts:
for h in host1 host2
do ssh $h <commandline>
done
The list of hosts can be read from a file with $(cat <some filename>) or
generated in some other way, and if the list is to big for that, then
cat list | while read h ; do ... ; done
Oh yes, indeed... and that's another reason to appreciate the single
command working on files rather than think hard about how to deal with
redirection in the remote command. You're probably not surprised I
ended up several times with one new file on the workstation rather
than one on each of the remote hosts ;-)
I don't believe it!
One of my current favourite tricks is
cat .ssh/id_dsa.pub \
| ssh remote.example.com cat - '>>' .ssh/authorized_keys
I refined this yesterday to
cat .ssh/id_dsa.pub \
| ssh remote.example.com tee -a .ssh/authorized_keys
but, on reflection, I'm not sure I want the key splattered over my
screen each time.
Works great when you clone the servers and they all have the same host
keys ... <slam> <slam>
When I was running 100+ Linux virtual machines on my P/390, I started
with a "forall" script that issued the command on each of them. But
waking up all the servers at the same time is not nice and not really
necessary. Next version was a "forsome" that took 2 extra numbers to
specify the range of servers to address. And finally I scheduled it
with "at" for each of the groups.
I run some psql queries at times, a lot at once, against a postgresql
database, and display the results. It works nicely inside screen:
screen <some command>
A problem I had was hitting the server with too many concurrent logins,
so I inserted a sleep into the list of commands, so as to add one every
few seconds.
--
Cheers
John
-- spambait
[EMAIL PROTECTED] [EMAIL PROTECTED]
Please do not reply off-list
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390