prasath.srinivasan at wipro.com writes:
> 
> Hi,
> 
> I got a service which checks whether the service is already running
> before attempting to start it again. 
> 
> Now I start it in the legacy manner i.e. "<path> <servicename> start"
> 
> This starts the service.
> 
> After this, when I give svcadm enable <FMRI of the service>, again it
> executes the start method and the previous process is killed and a new
> process is initiated. 
> 
> Can someone clarify me if the same process cannot be retained because
> when the smf executes the start method, it vcerifies for previous
> instance of the process and returns 0, which is not sufficient for the
> service to change to online state. So the SMF feature executes stop once
> and starts again.
> 
> Pleas do clarify me on this.
> 
> 
> Thanks,
> Prasath

svc.startd uses contracts (man contract(4)) to keep track of processes that
are running in a service.  Since you started your service manually, startd
has no knowledge that it is running.  That is to say, it does not hold any
contracts for those processes.

I assume that your service is a contract model service, since that is the
default in the manifest.  See the svc.startd(1M) man page and look for
"duration" for an explanation.

When you invoke svcadm enable for your service, started invoked your start
method.  Your start method exited without starting any other processes.  As
far as startd is concerned, all processes in your service exited.  In the
contract model it is considered a service failure when all processes exit.
Since your service "failed", startd attempts to restart it.

The bottom line is if you want your service to be properly controlled by
SMF, then you must start it using SMF commands (svcadm enable).

tom

Reply via email to