Marcy Cortes wrote:
Sorry for that signature stuff on the previous attempt at mailing.
--------------
I use xargs like:
Like: cat linuxes | xargs -t -i{} ssh {} ls /root
If one wraps "ssh {} ls /root" in another script (and maybe include
stuff the mail the report), then
xargs -P 5 ...
is possible and, on larger numbers of hosts and/or where hosts are
remote then things can be speeded up handily.
Here's how I update Debian* boxes remotely:
06:40 [EMAIL PROTECTED] ~]$ cat bin/deb.update
#!/bin/bash
set +x
for h in $(cat ~/.etc/coco.hosts)
do export h
if [ -n "${DISPLAY}" ] ; then
h=$h xterm -geometry 90x25 -fg black -bg white \
-fn \
-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1 \
-e bin/deb.update1&
else
openvt -s -- bin/deb.update1
fi
done
06:40 [EMAIL PROTECTED] ~]$ cat bin/deb.update1
#!/bin/bash
clear
echo Connecting to ${h}
ssh -C -t ${h} sudo bin/update
06:40 [EMAIL PROTECTED] ~]$
* That was the intention. bin/update can, of course, do equivalent
processing on RHEL, SLE{S,D}, Slack - anything.
I don't use xargs, but it would scale better if I did and limited it to,
say, six at a time - because in my cases, bin/update is marginally
interactive.
Marcy Cortes
"This message may contain confidential and/or privileged information. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based on
this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."
-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of
Michael MacIsaac
Sent: Thursday, July 12, 2007 8:45 AM
To: [email protected]
Subject: [LINUX-390] Wrapper around SSH to run command on mutliple
Linuxes?
Hello list,
Does anyone have a simple wrapper around SSH to run the same command on
multiple Linuxes?
If I have key-based authentication set up from one server to another
server, call it "linux01", I can issue the command:
# ssh linux01 ls /root
bin
and see the output from linux01 without needing a password.
But let's say I'd like to issue that command on 5 different linuxes. I
could call the command dssh and define a group "linuxes" that consist of
linux01-linux05. Then I could issue the command:
# dssh linuxes ls /root
linux01:
bin
linux02:
bin
linux03:
bin
linux04:
bin
linux05:
bin
and see the output from each member in the group.
I thought about cobbling together a script, but certainly this has been
written. Maybe there's already an RPM in my distro that just has to be
installed.
--
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