If xargs (especially -P; I didn't know that!) doesn't work, life gets
a lot more complicated.

I found a discussion on Slashdot about this from 2003; it mentions a
Sourceforge project to make a dsh that's vanished, and something
called distribulator that looks promising.  See:
http://ask.slashdot.org/article.pl?sid=03/06/17/2323248, and
especially http://ask.slashdot.org/comments.pl?sid=67987&cid=6233171
Distribulator is at http://sourceforge.net/projects/distribulator/

This is a hard problem in general, and I don't know of any
other public-domain tools that really address it .  The problems are:
 * If your SSH keys aren't completely up-to-date you get password
   prompts and things stick.
 * If you have multiple environments (even SuSE 8 and 9) the prompts
   are different.
 * If a server is down the script hangs.
 * If you run in parallel the output can get intermixed.
I used to work in a group that did this across around 1500 servers in
a very heterogeneous environment; we had two competing scripts that
would do this---after a fashion.  There was always a lot of cleaning
up by hand if we had to get every single machine.

Another way to do it is to have a specialized daemon on each system
like radmind or cfengine.  Then you get into authentication and
security issues, or your scripts run more when the daemons feel like
it rather than when you need an answer.  Cfengine is a brilliant piece
of work, but this isn't quite the problem for which it was built.

Ted Rodriguez-Bell
[EMAIL PROTECTED]

On Fri, 2007-07-13 at 06:44 +0800, John Summerfield wrote:
Marcy Cortes wrote:
> >
> > 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.
>
>
>
>
>
----------------------------------------------------------------------
> 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

----------------------------------------------------------------------
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

Reply via email to