On Mon, May 22, 2006 at 08:54:05AM -0700, Marcel Widjaja wrote:
> Thank you.  Would it be possible for a service to automatically disable
> itself if it fails to start?

It can:

. /lib/svc/share/smf_include.sh

...

if $failed; then
        exit $SMF_EXIT_ERR_FATAL
fi

If it's a configuration problem, SMF_EXIT_ERR_CONFIG is a better exit code.

These don't disable the service; they put it into maintenance, so that an
administrator will notice the problem.

See smf_method(5) for full details.

Cheers,
- jonathan

> -Marcel
> 
> David Bustos wrote On 05/19/06 14:01,:
> 
> >Quoth Marcel Widjaja on Thu, May 18, 2006 at 02:49:59PM -0700:
> >  
> >
> >>How do I start a service or demon at run level 2 using SMF? My service
> >>manifest contains the following dependency:
> >>
> >>         <dependency
> >>                name='multi-user'
> >>                grouping='require_all'
> >>                restart_on='none'
> >>                type='service'>
> >>                <service_fmri value='svc:/milestone/multi-user' />
> >>        </dependency>
> >>
> >>Is this correct?
> >>    
> >>
> >
> >No.  If you're taking a service out of rc2.d, then you need to have
> >a dependency on milestone/single-user, and you need to declare
> >milestone/multi-user as a dependent (not a dependency).  This will
> >ensure that you start after the rcS.d scripts, before any rc2.d scripts
> >which may depend on you (though before any rc2.d scripts which you may
> >depend on, so you can only do this if your rc2.d dependencies have also
> >been adapted to SMF), and that you will run if the user executes
> >'init 2' or 'svcadm milestone multi-user'.
> >
> >
> >David
> >  
> >
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org

-- 
Jonathan Adams, Solaris Kernel Development

Reply via email to