Managing System Services in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014

Creating an SMF Service

A service manifest contains the complete set of properties associated with a specific service, including instances, dependencies, scripts to run when the service starts and stops, and default application property values. Manifests also provide template information such as a description of the service. See the service_bundle (4) man page and the /usr/share/lib/xml/dtd/service_bundle.dtd.1 service bundle DTD for a complete description of the contents and format of an SMF manifest. See also Naming Services, Instances, Property Groups, and Properties for naming rules and assigning property group types.

Using the svcbundle service bundle generator tool is a good way to create a simple service or to start a more complex service. For more information, see the svcbundle (1M) man page. You can use the service bundle DTD and other service manifests to complete a more complex service.

The standard location for custom manifests is /lib/svc/manifest/site. Manifests stored in this location are imported into the service configuration repository by the svc:/system/early-manifest-import:default service during the boot process before any services start. Running the import process early ensures that the repository will contain information from the latest manifests before the services are started. Manifests stored in this standard location are also imported when the svc:/system/manifest-import service is restarted.

Multiple manifests can be used to describe a single service. This can be useful, for example, to define a new instance of a service without modifying the existing manifest for the service. However, if the same property in the same layer for the same service or instance is defined by multiple manifests, SMF cannot determine which value to use. When this type of conflict is detected, the instance is placed in the maintenance state. See Repository Layers for more information about layers.

Add name and description metadata to your manifests so that users can get information about this service from the svcs and svccfg describe commands. You can also add descriptions of property values. See the value, values, and template elements in the DTD.

Use the svccfg validate command to validate your service manifest file or service instance FMRI. With your manifest, method, and profile files in standard locations, restart the manifest-import service to install and configure your service instances. Use the svcs command to check the status of your service instances.

This section shows how to create custom SMF services. The site prefix is reserved for site-specific customizations. A service named svc:/site/service-name will not conflict with the services delivered in an Oracle Solaris release.