The following section includes information about how to create, modify, and display SMF service instances. It also covers information about SMF access controls:
Each SMF scheduled service is managed by a restarter. The master restarter svc.startd manages states for the entire set of service instances and their dependencies. The master restarter acts on behalf of its services and on delegated restarters that can provide specific execution environments for certain application classes. For example, inetd is a delegated restarter that provides its service instances with an initial environment. Each service instance delegated to inetd is in the online state. While the daemon of a particular instance might not be running, the instance is available to run. As dependencies are satisfied when instances move to the online state, svc.startd invokes start methods of other instances which may overlap. See the smf_restarter(7) man page to view the configuration settings for all SMF restarters.
Each service or service instance must define a set of methods that start, stop, and, refresh the service. For a complete description of the method conventions for svc.startd and similar restarters, see the smf_method(7) man page. Administrative methods, such as for the capture of legacy configuration information into the repository, are discussed in the svccfg(8) man page.
A scheduled service instance in SMF requires a specific time which is delegated by the scheduled_method element. The scheduled_method element specifies both method and scheduling information for scheduled services.
For more information on constraints and how to specify the scheduled_method element, see Specifying the scheduled_method Element in Developing System Services in Oracle Solaris 11.4.
The following example shows how to create an SMF scheduled service instance to run automatically at 1:00 a.m. every Sunday morning.
<?xml version='1.0'?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <service_bundle type='manifest' name='site/sample-periodic-svc'> <service type='service' version='1' name='site/sample-periodic-svc'> <instance name='default' enabled='false'> <scheduled_method schedule='month' day='0' hour='1' minute='0' exec='/usr/bin/scheduled_service_method' timeout_seconds='0'> <method_context> <method_credential user='root' group='root' /> </method_context> </scheduled_method> </instance> </service> </service_bundle>
For more step-by-step information on how to create a periodic service, see Chapter 3, Creating a Service to Run Periodically in Developing System Services in Oracle Solaris 11.4.