background processes under 4.2bsd

martin at nosccod.UUCP martin at nosccod.UUCP
Sat Feb 25 01:38:14 AEST 1984


     In most cases, it is an advantage that background processes are not
interrupted when the login shell dies.  One very simple way to kill a
background job at logout, is to pass the
process id of the parent shell (login shell) to the job as an argument.
E.g. run 'prog $$ &' where $argv[1] contains the process id of the parent.
If the background job doesn't have much to do, periodically check
to see if the parent process is still around, and if the background process is orphaned, kill it.
Having the background job monitor the status of the login process is
time consuming, but it works.
Doug Martin        martin at nosc



More information about the Comp.unix.wizards mailing list