background processes under 4.2bsd

chris at umcp-cs.UUCP chris at umcp-cs.UUCP
Tue Feb 21 10:17:21 AEST 1984


[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 at umcp-cs		ARPA:	chris.umcp-cs at CSNet-Relay



More information about the Comp.unix.wizards mailing list