Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.unix-wizards Subject: Re: background processes under 4.2bsd Message-ID: <5319@umcp-cs.UUCP> Date: Mon, 20-Feb-84 19:17:21 EST Article-I.D.: umcp-cs.5319 Posted: Mon Feb 20 19:17:21 1984 Date-Received: Tue, 21-Feb-84 08:10:18 EST References: <989@druxy.UUCP> Organization: Univ. of Maryland, Computer Science Dept. Lines: 22 [Recap: problem is to kill a background process automatically when logged out.] The problem is that those background processes are assigned separate process groups. This is a very nice feature (but seems to be hard for people to understand). The hangup signal sent when you get logged out is sent to the process group of the terminal. This is not the same as the group for the background command (if it's still in the background) and the bg command never sees the signal. Possible solutions: - Use getlogin() to see if you've been logged out. This is how the leave(1) program works. - Use the Bourne shell as your login shell. The Bourne shell doesn't manipulate process groups (at least in 4.1), so merely trapping the hangup signal will do the trick. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris.umcp-cs@CSNet-Relay