[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#97336: ITP: dsh -- dancer's shell, or a distributed shell.



On Tue, May 15, 2001 at 05:46:55PM -0400, Rob Latham wrote:
> Junichi Uekawa (dancer@netfort.gr.jp) said:
> 
>  
> > It uses rsh or ssh.
> > 
> > It's a replacement to :
> > 
> > for a in $(seq 1 100); do rsh note-$a w ; done
> 
> it's a bit more fun (though harder to sort the output) if you do
> 
> for a in $(seq 1 100); do rsh -n note-$a w & ; done
> 
> and the obvious refinement is to prefix each line with the node name,
> then use sort with whatever parameters make it sort on the first
> column with no regard for other columns.  
> 
> it's those "whatever parameters" that keep me from backgrounding N rsh
> jobs on a regular basis.

 Oh, you mean  sort -s -k 1,1

I have used this script to start stuff on a bunch of Solaris workstations at
school.  It uses ping because not all the workstations are always up.  On
Linux, fping would give equivalent functionality to the way I'm using
Solaris' ping here.  It also use usleep between forking off rsh processes,
so as not to run the system out of ports or ptys.

#!/bin/bash

# copyright Peter Cordes 1999.  License: GPL

# wscmd : run a given command on all workstations.


#this path gets GNU grep, not Sun's grep.  (needed when run from cron.)
export PATH=/opt/gnu/bin:/opt/bin:/usr/bin:/usr/ccs/bin:/opt/SUNWspro/bin:/sbin:/usr/sbin:/pub/bin:/pub/local/bin:/opt/samba/bin:/usr/proc/bin:~/bin

hostlist=~cordes/etc/wscmd.hosts

if [ 0 = $# ];then echo 'usage: wscmd args for rsh'; exit 1; fi

hosts=$(grep -v '^#' "$hostlist" | awk '{print $2}' )

for i in $hosts;do
# echo to keep output from a machine together
	if ping $i 2|grep -v 'alive'; then continue;fi
	echo "$i: $( rsh 2>&1 -n $i $@ )" &
	~cordes/bin/usleep 100000
done

echo waiting for bg jobs 1>&2
jobs  1>&2

wait


-- 
#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter@llama.nslug. , ns.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BCE



Reply to: