Xref: utzoo comp.mail.misc:2317 comp.unix.xenix:7354 comp.unix.wizards:17893 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!ctrsol!seth From: seth@ctr.columbia.edu (Seth Robertson) Newsgroups: comp.mail.misc,comp.unix.xenix,comp.unix.wizards Subject: Re: Checking for new mail (and killing bkgnd process on logout?) Message-ID: <1989Aug30.053137.2047@ctr.columbia.edu> Date: 30 Aug 89 05:31:37 GMT References: <105@csnz.co.nz> <1989Aug26.200813.15629@twwells.com> <64@calcite.UUCP> <128@isgtec.UUCP> Reply-To: seth@ctr.columbia.edu (Seth Robertson) Organization: Columbia University Center for Telecommunications Research Lines: 28 In article <128@isgtec.UUCP> bmw@isgtec.UUCP (Bruce Walker) writes: >the process >disconnects from your tty and continues running ... >My (slightly klugey) solution is to add a line to my .logout (csh): > /bin/kill -9 `ps x | awk '$5=="checkmail" {print $1}'`& >Anyone know a better way? Sure, Modify checkmail so that does the following: if (kill(ppid,0)) exit(1); So every so often, it checks to see if its parent is around. If it isn't, it performs honorable suicide. Actually, it is also a good idea for the program to make its real PPID to be 1. That way you won't accidently kill it && you won't see it when you do things like `jobs` (You would do it by having the program call itself && having the first copy kill itself off. The second copy then gets a new process group and its parent id gets reset to 1.) -- -Seth Robertson seth@ctr.columbia.edu