-------- Original Message -------- Subject: Re:[smf-discuss] How to make a service go into maintenance. From: Brian Utterback <brian.utterb...@sun.com> To: Renaud.Manus at Sun.COM Cc: smf-discuss at opensolaris.org Date: Fri Apr 27 2007 17:57:37 GMT+0200 (CEST)
> I have a question. In the man page for smf_maintain_instance, it says > that it can take two flags, SMF_TEMPORARY and SMF_IMMEDIATE. It says > that SMF_TEMPORARY means that the state lasts only for the lifetime > of the current system instance (SMF-speak for until reboot?) and yes > that SMF_IMMEDIATE takes place immediately killing any running methods. > By "running method", does that include the actual daemon process? yes > do I need to do the smf_disable_instance as well? What if I want the > smf_maintain_instance to be temporary and immediate, can I combine the > flags? yes > The man page also says that effect of these calls is > asynchronous; if I do the smf_maintain_instance and then exit, will > the restarter start it up again if smf_maintain_instance hasn't taken > effect yet? If so, how do I prevent that? No, it means that when you return from smf_maintain_instance(), your instance is not guaranteed to be in maintenance state yet. But the request has been posted and will take effect after you exited. You can take a look at usr/src/cmd/svc/svcadm/svcadm.c to see how to simulate a synchronous call. -- Renaud > > Sorry if these are basic questions. I looked in the man pages, but > couldn't find the answers. > > Renaud Manus wrote: >> -------- Original Message -------- >> Subject: Re:[smf-discuss] How to make a service go into maintenance. >> From: Brian Utterback <Brian.Utterback at Sun.COM> >> To: Renaud.Manus at Sun.COM >> Cc: smf-discuss at opensolaris.org >> Date: Wed Apr 04 2007 15:14:55 GMT+0200 (CEST) >> >>> Okay, at least it is doable. Now, can it be done programatically >>> from within the daemon? >> >> Yes, by using the libscf API and smf_maintain_instance() / >> smf_disable_instance() >> >> -- Renaud >> >>> >>> Renaud Manus wrote: >>>> -------- Original Message -------- >>>> Subject: [smf-discuss] How to make a service go into maintenance. >>>> From: Brian Utterback <Brian.Utterback at Sun.COM> >>>> To: smf-discuss at opensolaris.org >>>> Date: Wed Apr 04 2007 14:57:16 GMT+0200 (CEST) >>>> >>>>> I have two related questions. The first is how can a daemon supplying >>>>> a service indicate that there is a problem and that the service should >>>>> go into maintenance rather than having the restarter restart it? >>>> >>>> svcadm mark maintenance FMRI >>>> >>>>> >>>>> Secondly, on a related note, is there anyway to mark a service as >>>>> "not applicable"? If, for instance a service that was designed >>>>> specifically for a particular configuration found itself started >>>>> on a system without that configuration, is there a way for the >>>>> daemon to exit and not get restarted and not appear in maintenance >>>>> but still get started on the next reboot? >>>> >>>> Your daemon could just disable it until the next reboot: >>>> >>>> svcadm disable -t FMRI >>>> >>>> Does that help? >>>> >>>> -- Renaud >>>> >>> >> >