[can.usrgroup] Help with background processes

chk@dciem.dciem.dnd.ca (C. Harald Koch) (09/09/89)

I am using the latest version of Month (8.7) on a Sun runing SunOS3.4. There
is a daemon program that you can run in the background to tell you about
upcoming events.

The daemon process code claims that the process group of a process is set to
zero when the person who spawns that process logs off. This is obviously not
working; There were 13 monthd programs running on different terminals here
today (and all of them were writing *my* appointments to everyone else's
terminals!)

I need a fix. I need a sure-fire way for a process to detect that the person
who spawned it is no longer logged on on that terminal.

	Help!


-- 
          C. Harald Koch          NTT Systems, Inc., Toronto, Ontario          
     chk@gpu.utcs.utoronto.ca,  chk@dretor.dciem.dnd.ca,  chk@chk.mef.org
"There is no problem, no matter how large or how small, that cannot be solved
by an appropriate application of high explosives."            -Leo Graf, 2298

cks@ziebmef.mef.org (Chris Siebenmann) (09/12/89)

chk writes:
| I need a fix. I need a sure-fire way for a process to detect that the person
| who spawned it is no longer logged on on that terminal.

 If you are starting these daemons from your login shell, my favorite
method is to check for the parent process ID going to 1. This is
infallible, since it's done by the kernel only when the parent dies.
If the daemons are started at other times, I suspect they'll just have
to be hacked to watch /etc/utmp.

	- cks