Path: utzoo!mnetor!uunet!husc6!bbn!bbn.com!mesard From: mesard@bbn.com (Wayne Mesard) Newsgroups: comp.unix.questions Subject: killing daemons Message-ID: <20917@bbn.COM> Date: 18 Feb 88 02:48:48 GMT Sender: news@bbn.COM Reply-To: mesard@bbn.com Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 23 I recently wrote a program that runs in background for the duration of a login session. When it starts it gets its parent process id: ppid = getppid(); if (fork()) exit(0); During execution it occasionally checks to see if the parent is still around, and commits suicide if it isn't: if (kill(ppid, 0)) exit(0); Since this statement gets executed every couple of minutes, the background job is guaranteed to go away shortly after the parent (i.e. the login shell) does. My question is ==> Is there a better / more direct / more socially acceptable way to reap background processes? This method seems like asking wheat to cut itself down as the combine drives by. (unsigned char *) Wayne_Mesard() MESARD@bbn.com