Hi David 
Thanks for your response, quite helpful

I have one more problem here.
I created a service manifest xml file,  the start method is a shell
script (say SCRIPT)which wraps my MAIN process.
Actually 'exec MAIN' is called in this script. And MAIN will startup
many PLUGINs
And the properties are like this: 

        <exec_method
                type='method'
                name='start'
                exec='/home/ejiaden/SCRIPT start'
                timeout_seconds='60' >
                <method_context>
                <method_credential user='ejiaden' group='cnshlogin'/>
                </method_context>
        </exec_method>   

        <property_group name='startd' type='framework'>
                <propval name='ignore_error' type='astring' value='core,
signal' />
                <propval name='duration' type='astring' value='contract'
/>              
        </property_group>

Coredump from PLUGINs and Killing PLUGINs will not cause the whole
contract to be killed, because MAIN can monitor those PLUGINs and
restart them its self, so I used 'ignore_error' as above.  
But when I kill -9 MAIN separately, SMF will do nothing(did not kill all
subprocess and restart MAIN), does SMF treat MAIN also as a 'subprocess'
and just ignore the kill signal? Does this conflict with the
'ignore_error'? I just want the whole contract to be killed and the
service to be restarted when I kill MAIN, that means SMF only ignores
coredump and signal from PLUGINs, but not MAIN. 

It seams that any the 'ignore_error' is effective for all processes,
right?

Thanks 

//James



-----Original Message-----
From: David Bustos [mailto:david.bus...@sun.com] 
Sent: Friday, August 25, 2006 02:03
To: James Deng D (SH/CBC)
Cc: smf-discuss at opensolaris.org
Subject: Re: [smf-discuss] SMF and child processes

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