Quoth James Deng D (SH/CBC) on Thu, Aug 24, 2006 at 06:32:01PM +0800:
> We have a monitor process (say MONITOR) and main process (say MAIN)
> MONITOR starts MAIN and keep track of MAIN's status, MAIN may be stop
> and started by MONITOR. 
> MAIN will start a number of subprocesses (say PLUGIN).
> 
> MONITOR ----> MAIN -----> ( PLUGIN1, PLUGIN2, ...)
> 
> Using SMF, we can just remove the MONITOR, let MAIN to be managed by
> SMF, 
> If in contract mode, when I disable MAIN, all PLUGINs will be stoped,
> that's what I want
> But when I enable MAIN, Will SMF restart all the PLUGINs ? If so, that
> would be confusing, because MAIN is able to start all the PLUGINs its
> self.

It will not.  It doesn't know how to.  SMF only knows to exec() the
string you give it in your start method, which will presumably be how to
start your main process.  If that main process choses to start
subprocesses, it may.

> Is it possible that SMF just ignores these child processes and let my
> MAIN manage them independently? That means not all the (sub)processes
> are in on contract.

I think you mean that if the main service is disabled, then the
subprocesses won't be stopped.  That can be accomplished by having the
main process launch the subprocesses in separate contracts.  Ideally
this can be done by modifying the main process to use libcontract(3LIB).
(See process(4).)  Or you can have the main process execute the
subprocesses through ctrun(1), which will create a new contract.  Search
the archives of this list for more discussion on this.

> Is child mode service an alternative?

Yes.  It's less than ideal, though, because then your subprocesses will
all be in the same contract (so if one encounters a hardware error, they
will all be killed), and if your main process dies and is restarted, it
won't be given the contracts of the subprocesses.


David

Reply via email to