RSH (remote shell) - must all children die before remote part exits?

Chris Torek chris at mimsy.umd.edu
Wed Dec 13 17:52:12 AEST 1989


In article <1035 at anasaz.UUCP> duane at anasaz.UUCP (Duane Morse) writes:
>Is it a feature of rsh that the process started on the remote end
>and all of its children terminate before the remote shell (and its
>partner on the local side) terminate? That seems to be the way it
>works on our Pyramid MIS machine and a couple of 386/IX boxes.

No; that is not how it works.  Rsh waits not for processes to exit,
but rather for EOF on its socket.  Since the socket is naturally
closed once all processes exit, this will cause rsh to finish; however,
by closing the socket earlier, rsh will get an EOF sooner, and
it will finish sooner:

#! /bin/sh
#
# xrsh - start an X11 process on another host
#
# simply exports $DISPLAY, and runs the given command

case $# in
0|1) echo "usage: $0 host cmd [args]" 1>&2; exit 1;;
esac

: ${DISPLAY?"no DISPLAY environment variable"}

host="$1"
shift

rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ </dev/null >&/dev/null"
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list