Hi Paul,

It doesn't matter if your java program exits with 95 or 96 (or whatever
return value) since your service is a contract type service and its
start method has already returned. SMF interprets the return
code of start/stop/refresh methods only.
In your situation, SMF detects that the process unexpectedly exits and
since it was the last process in the contract, restarts it
automatically.
The info from the FAQ works only if the process coredumps or exits due
to an external signal (eg. kill -9) and this is not happening in your
case.
If you don't want your service to restart when the process exits then 
yes, the process could temporarily disable itself rather than returning
95/96. You could also fix the java program so it stops exiting!

-- Renaud

Paul Willis wrote:
> I have converted a legacy rc script to run via SMF.
> For my method and manifest templates, I used the /lib/svc/method/postgresql 
> and /var/svc/manifest/application/database/postgresql.xml.
> 
> The method script starts a Java file running in the background then 
> immediately returns a 0.
> (This java file is really an application that we want to start at boot time 
> and not a traditional service daemon.)
> 
> Everything works fine unless there is a problem with the Java file which 
> forces it to terminate with an error, returning either 95 or 96. 
> (SMF_EXIT_ERR_FATAL/CONFIG)
> 
> So the sequence of events is:
> 1. The start method is executed
> 2. The start method runs a Java file in the background
> 3. The start method exits with a return code of 0
> 4. The Java file terminates with an error exit code of 95 or 96
> 5. The stop method is executed: "... all processes in service exited."
> 6. The start method script is executed
> 7. Repeat events 1-6 forever
> 
> I read the FAQ question ?What do I need in my manifest to keep my service 
> from restarting every time it core dumps or a child process exits?? =>  
> http://opensolaris.org/os/community/smf/faq/#toc54  <=
> 
> I implemented the property_group as outlined in the response but the 
> restarter is still attempting to do a restart.
> 
> Questions:
> Am I missing something or am I misusing the changes outlined in the FAQ?
> Should I just have the java code disable itself (svcadm disable 
> svc_name:svc_inst) rather than depending on SMF interpreting the return error 
> code? 
> 
> Thanks
> Paul W
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org

Reply via email to