Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: RSH (remote shell) - must all children die before remote part exits? Message-ID: <21262@mimsy.umd.edu> Date: 13 Dec 89 06:52:12 GMT References: <1035@anasaz.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 31 In article <1035@anasaz.UUCP> duane@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" -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris