Go to main content

Developing System Services in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Creating a Periodic Service

A periodic service manifest is very simple, as shown in the following example. See also Creating a Periodic Service Using the Service Bundle Generator Tool.

Example 2  Periodic Service Manifest

The periodic service instance is completely defined in the periodic_method element. For this example service, the periodic restarter executes the start method every 30-35 seconds after an initial delay of 15 seconds. The template element is recommended to help administrators understand the purpose of this periodic service.

<?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'>

            <periodic_method
                period='30'
                delay='15'
                jitter='5'
                exec='/usr/bin/periodic_service_method'
                timeout_seconds='0'>
                    <method_context>
                        <method_credential user='root' group='root' />
                    </method_context>
            </periodic_method>

        </instance>

        <template>
            <common_name>
                <loctext xml:lang="C">
                    Sample Periodic Service
                </loctext>
            </common_name>
            <description>
                <loctext xml:lang="C">
                    What this service does periodically.
                </loctext>
            </description>
        </template>
    </service>
</service_bundle>