Go to main content

Developing System Services in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020

Creating an SMF Service

An SMF service consists of one or more service manifests and zero or more profile files. Service instances define methods to perform the work of the instance.

A service manifest contains the complete set of properties associated with a specific service, including instances, dependencies, application configuration properties, and methods to run when the service starts and stops. Manifests also provide template information such as a description of the service.

Profiles can define instances for a service that is already defined in a manifest. Profiles can define new properties for these service instances and new values for properties that are defined in the service manifest. Profiles cannot define template elements.

See the service_bundle(5) 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 SMF manifests and profiles. See also Naming Services and Instances for naming rules and information about assigning property group types, and see Property Group Types and Property Types for information about the values of different property types.

A method can be a daemon, other binary executable, or an executable script. See Creating Service Instance Methods for more information.

You can use multiple manifests to describe a single service. This method can be useful, for example, to define a new instance of a service without modifying the existing manifest for the service. See Creating a Service Using Multiple Manifests for more information.

Use the following best practices when creating a custom service:

  • Use the site prefix in the service name as described in Service Names in Managing System Services in Oracle Solaris 11.4. 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.

  • 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.

  • Use the smf_method_exit() function to document the successful or unsuccessful exit of a method script in the log file of the service instance.

  • Store your manifest, profile, and method files in the standard locations shown in the following table.

Table 1  Standard Locations of Service Development Files
Standard Location

Manifests and profiles stored in these locations 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 and profiles stored in these standard locations are also imported when the svc:/system/manifest-import service is restarted.

With your manifest, profile, and method 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.