Checking for new mail (and killing bkgnd process on logout?)
Seth Robertson
seth at ctr.columbia.edu
Wed Aug 30 15:31:37 AEST 1989
In article <128 at isgtec.UUCP> bmw at 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 at ctr.columbia.edu
More information about the Comp.unix.xenix
mailing list