Xref: utzoo comp.mail.misc:2316 comp.unix.xenix:7344 comp.unix.wizards:17884 Path: utzoo!censor!isgtec!bmw From: bmw@isgtec.UUCP (Bruce Walker) Newsgroups: comp.mail.misc,comp.unix.xenix,comp.unix.wizards Subject: Re: Checking for new mail (and killing bkgnd process on logout?) Summary: RTFB :-] Message-ID: <128@isgtec.UUCP> Date: 29 Aug 89 14:40:42 GMT References: <105@csnz.co.nz> <1989Aug26.200813.15629@twwells.com> <64@calcite.UUCP> Reply-To: bmw@isgtec.UUCP (Bruce Walker) Organization: I.S.G. Technologies, Toronto, Ontario Lines: 31 Since I haven't seen anyone mention it yet, I will: in the extremely well-written and useful book "The UNIX Programming Environment" by Kernighan and Pike, there is a small bit of C called "checkmail" (pg. 216). To link it you'll also need a code fragment called "error()" (pg. 207). This program does what none of the to-date posted ones do: it checks for the mail file *growing*, not just *changing*; otherwise you'll get "you have mail" messages after you read your mail (and it is deleted from your mailbox). Not mentioned in the book though, is the fact that this program will not work as advertised on BSD systems. You are supposed to start it like this (usually from .login): $ checkmail& which is fine under SysX, since when you log out, it goes away by itself. However, if you do this on a Sun (f'rinstance), the process disconnects from your tty and continues running (inherited by root). You end up with dozens of the little buggers. 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? -- Bruce Walker ...uunet!mnetor!lsuc!isgtec!bmw "Better Living Through Connectivity" ...utzoo!lsuc!isgtec!bmw ISG Technologies Inc. 3030 Orlando Dr. Mississauga. Ont. Can. L4V 1S8