Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site sdcrdcf.UUCP
Path: utzoo!watmath!clyde!floyd!harpo!seismo!hao!hplabs!sdcrdcf!jonab
From: jonab@sdcrdcf.UUCP (Jonathan Biggar)
Newsgroups: net.unix-wizards
Subject: Re: background processes under 4.2bsd
Message-ID: <857@sdcrdcf.UUCP>
Date: Tue, 21-Feb-84 12:08:28 EST
Article-I.D.: sdcrdcf.857
Posted: Tue Feb 21 12:08:28 1984
Date-Received: Thu, 23-Feb-84 04:41:00 EST
References: <989@druxy.UUCP>
Reply-To: jonab@sdcrdcf.UUCP (Jonathan Biggar)
Organization: System Development Corporation, Santa Monica
Lines: 18

In article <989@druxy.UUCP> jas@druxy.UUCP (ShanklandJA) writes:
>Question:  How do you start a background process at login time
>that is guaranteed to terminate when the user logs out (or is
>logged out)?

You could have a line like:

if ("`tty`" == "not a tty") exit

in your loop.  This will test stderr to see if it is still
attached to a terminal, and if not, will cause the program to exit.

This is only tested on 4.1, but I would assume it would work for
4.2 also.

Jon Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdccsu3,trw-unix}!sdcrdcf!jonab