Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ucla-cs!ames!ptsfa!hoptoad!academ!killer!jfh From: jfh@killer.UUCP Newsgroups: comp.unix.wizards Subject: Re: Big fun with initttab! Message-ID: <945@killer.UUCP> Date: Fri, 29-May-87 09:37:23 EDT Article-I.D.: killer.945 Posted: Fri May 29 09:37:23 1987 Date-Received: Thu, 4-Jun-87 05:06:05 EDT References: <90@paisana.UUCP> Organization: The Unix(tm) Connection, Dallas, Texas Lines: 51 Keywords: processes, dying children etc... Summary: Try the book ... inittab(4) In article <90@paisana.UUCP>, demasi@paisana.UUCP (Michael C. De Masi) writes: > > Hello Wizards, (male & female, alike) Hello mere end user :-) :-) :-) > > Here's an interesting problem (I think) I have a process which > gets kicked off by a shell. This process (pure executable) depends > upon the calling shell to set up its environment and create some > named pipes. This process should run at all times while the machine > (3b2/400, SV.2.0.4) is in multi user mode. Sounds like a good task > for an inittab entry, correct? The only problem is that the process > that must be kept continuously running is a background process, which > gets called by the afformentioned shell, which croaks immediately > after invoking the background process. Therefore, making an inittab > entry for the invoking shell is useless. (Actually, it's a disaster, > since the shell simply: 1) Sets up the background environment > 2) Invokes the pure executable 3) Dies 4) Gets called again > infinitely until init turns it off) Two thoughts come to mind at this point. Write some more executable code to set up the environment, and then exec() your executable (or if you have the sources to your executable, mung on them so that it does the setup. Second thought, experiment with using "exec" in the shell. That may just do the trick. > Does anybody know of a way that I can get init to watch for the death > of the Child process here and then have it call the invoking shell to > restart said process? I already have an entry to restart the process > once every time the machine enters multi-user, but I'm hoping for > something to keep it moving. Yes, the trick however is that the child process _DOES_ die, and init detects it. Init knows nothing about what processes a process has started and doesn't (can't) wait for the children of a process to die - AND - know which process started them off. When your shell dies, the children of the shell are orphaned :-( how sad )-: and are inherited by init like any other orphan. Init wakes up and sees that one of its processes died and looks to see what action was specified in the inittab. Sounds like you are using respawn, so init recreates the process. Try one of the suggestions in the first paragraph, or failing there, change from respawn or ondemand to once. - John. Disclaimer - No disclaimer. Whatcha gonna do, sue me?