Search code examples
solarissmf

Enforce running a service before another one on Solaris smf


I am trying to set other services to be dependant on mine (in order to enforce mine to run first) using the Solaris SMF system.

I know I can use the tag in the other service manifest and make it depends on my service, but I would like to avoid editing the other services manifests for obvious reasons.

According to this link, under the "Dependencies" section, it is stated that it is possible but I couldn't figure out how.

Thanks


Solution

  • You do that in the manifest with the dependent XML element as opposed to the dependency element.

    Suppose you want "serviceA" to depend on your fancy new service, called "serviceMine", but you cannot change the manifest for "serviceA".

    Then in the manifest for "serviceMine" you would do something like

    <dependent  name='serviceMine_dependency'
                 grouping='require_all'
                 type='service'
                 restart_on='restart'>
      <service_fmri value='svc:/application/foo/serviceA' />
    </dependent>
    

    Documentation

    When the going gets tough I sometimes resort to the documentation which is in the DTD for SMF manifests. You can read it at: /usr/share/lib/xml/dtd/service_bundle.dtd.1 on your local system. It is quite useful as a reference.