[ale] Running a command on multiple servers
    Ed Cashin 
    ecashin at noserose.net
       
    Fri Jun 12 14:17:37 EDT 2009
    
    
  
On Fri, Jun 12, 2009 at 11:05 AM, Richard Bronosky<Richard at bronosky.com> wrote:
...
> if you what it to happen simultaneously instead of sequentially, you can do:
>    screen
>    for h in host1 host2 host3; do screen ssh $h 'top -b;' & done
> ...each ssh connection will happen is a different screen window. The
> caveat is that when to process terminates, the ssh connection/process
> stops. When the command screen evoked (ssh) terminates, the window
> closes. I don't know how to overcome that off the top of my head. I
> tried a few things. Will research more if you like the method.
Maybe you're thinking of wait?
For example,
  (for i in `seq 1 10`; do sh -c "sleep $i; date" & done; wait)
The parens create a subshell so that it doesn't try to wait for xterm
or firefox or something extraneous that was previously launched in
the background.
-- 
  Ed Cashin <ecashin at noserose.net>
    
    
More information about the Ale
mailing list