On Thu, Sep 2, 2021 at 4:55 PM Kent Watsen <[email protected]> wrote: > Thanks Joshua. > > There's an import error, assuming the following snippet: > > <dependent name='zones' grouping='optional_all' restart_on='none'> > <service_fmri value='svc:/system/zones' /> > </dependent> >
The way to think about this is that this is equivalent to a dependency snippet in the corresponding service - called "zones" there too. Other services can also have such a snippet, that would again correspond to a dependency service. You've now created two dependencies, with the possibility name collisions between them. And, in fact, the zonestat service already has the same dependent snippet on the zones service, and it's called the dependency "zones". That's what already exists. So the fix is to use a name in your dependent snippet that is unique to your service, something like name="apcupsd_zones" would probably work. > is in /var/svc/manifest/system/apcupsd.xml: > > # svccfg -v import /var/svc/manifest/system/apcupsd.xml > svccfg: Could not create "zones" dependency in svc:/system/zones > (already exists). > svccfg: Import of > /var/svc/manifest/system/apcupsd.xml failed. Progress: > svccfg: Service "system/apcupsd": some properties imported. > svccfg: Instance "default": not reached. > svccfg: Import of /var/svc/manifest/system/apcupsd.xml failed. > > Looking at the manifest for svc:/system/zones, there is a dependency on > "multi-user-server”. Is my SMF automatically part of "multi-user-server” > milestone and so a circular dependency is created? Otherwise, I don’t > understand the "already exists” message. > > FWIW, the entire SMF file is below. > > Thanks, > Kent > > <?xml version="1.0"?> > <!DOCTYPE service_bundle > SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> > > <!-- Service manifest for the apcupsd APC UPS Monitoring Daemon --> > > <service_bundle type="manifest" name="apcupsd:apcupsd"> > <service name="system/apcupsd" type="service" version="1"> > > <create_default_instance enabled="false"/> > > <single_instance/> > > <dependency name="loopback-network" grouping="require_all" > restart_on="error" type="service"> > <service_fmri value="svc:/network/loopback"/> > </dependency> > > <dependency name="physical-network" grouping="require_all" > restart_on="error" type="service"> > <service_fmri value="svc:/network/physical"/> > </dependency> > > <dependency name="filesystem-local" grouping="require_all" > restart_on="none" type="service"> > <service_fmri value="svc:/system/filesystem/local:default"/> > </dependency> > > <dependency name="filesystem-autofs" grouping="require_all" > restart_on="none" type="service"> > <service_fmri value="svc:/system/filesystem/autofs:default"/> > </dependency> > > <!-- ensure ‘zones’ shut down before possible killpower command (even > with grace period) --> > <dependent name='zones' grouping='optional_all' restart_on='none'> > <service_fmri value='svc:/system/zones' /> > </dependent> > > <method_context> > <method_credential user="root" group="root"/> > </method_context> > > <exec_method type="method" name="start" exec="/lib/svc/method/apcupsd > start" timeout_seconds="60"/> > <exec_method type="method" name="stop" exec="/lib/svc/method/apcupsd > stop" timeout_seconds="60"/> > > <property_group name="application" type="application"> > <propval name="config_file" > type="astring" value="/etc/opt/apcupsd/apcupsd.conf"/> > </property_group> > > <stability value="Unstable"/> > > <template> > <common_name> > <loctext xml:lang="C"> > APC UPS Monitoring Daemon > </loctext> > </common_name> > <documentation> > <manpage title='apcupsd' section='8' manpath='/usr/share/man' /> > <manpage title='apcaccess' section='8' manpath='/usr/share/man' /> > <manpage title='apctest' section='8' manpath='/usr/share/man' /> > <doc_link name='online manual' uri=' > http://www.apcupsd.org/manual/manual.html' /> > </documentation> > </template> > </service> > > </service_bundle> > > On Sep 1, 2021, at 10:30 PM, Joshua M. Clulow via illumos-discuss < > [email protected]> wrote: > > On Wed, 1 Sept 2021 at 18:56, Kent Watsen <[email protected]> wrote: > > I currently have a “legacy_run” service that I’d like to ensure comes up > before svc:/system/zones yet after svc:/milestone/network + whatever > service is for USB devices. How to define an SMF that comes up *before* > another service…or do I need to edit the svc:/system/zones service to > depend on my new service? > > You want a <dependent> in your service that refers to the service you > want to start after you. You can see some examples of this in the > illumos cloud metadata agent; e.g., > > https://github.com/illumos/metadata-agent/blob/0e597fe7eddfc66656d894475015c88ae62f0ad3/metadata.xml#L48-L53 > > Cheers. > > -- > Joshua M. Clulow > http://blog.sysmgr.org > > *illumos <https://illumos.topicbox.com/latest>* / illumos-discuss / see > discussions <https://illumos.topicbox.com/groups/discuss> + participants > <https://illumos.topicbox.com/groups/discuss/members> + delivery options > <https://illumos.topicbox.com/groups/discuss/subscription> Permalink > <https://illumos.topicbox.com/groups/discuss/T3df709ee6e9b4d28-Mbc87eeaf2f2c35edc7dcff2a> -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ ------------------------------------------ illumos: illumos-discuss Permalink: https://illumos.topicbox.com/groups/discuss/T3df709ee6e9b4d28-Me53d96b3888906a4483f3fe5 Delivery options: https://illumos.topicbox.com/groups/discuss/subscription
