Go to main content

Developing System Services in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Creating a Scheduled Service

The following sample manifest is for a very simple scheduled service. See also Creating a Scheduled Service Using the Service Bundle Generator Tool.

Example 3  Scheduled Service Manifest

The scheduled service instance in this example is completely defined in the scheduled_method element. A scheduled service should use the fewest scheduling constraints required to schedule the task. For example, the periodic restarter will execute the start method for the following example service on the first day of each month, between 02:00 and 03:00. To invoke the method between 02:00 and 02:01, add the constraint minute='0'.

<?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
                interval='month'
                day='1'
                hour='2'
                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>