Go to main content

Developing System Services in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Specifying the periodic_method Element

When a periodic_method element exists, the instance is automatically delegated to the periodic restarter. The periodic_method element can be specified within a service element or within an instance element. The periodic_method element specifies both method and scheduling information for periodic services and can have the attributes and elements described in this section. The period and exec attributes are required.

Periodic Service Scheduling Constraints Attributes

The units for a time value are seconds, as shown in Figure 2, Table 2, Service Property Type Value Descriptions.

delay attribute

Optional. Value type: time. Default value: 0. The fixed number of seconds after the service has transitioned to the online state before the first invocation of the start method.

period attribute

Required. Value type: time. The number of seconds between invocations of the start method.

jitter attribute

Optional. Value type: time. Default value: 0. The maximum of a random number of seconds after period before the start method is run. The final number of seconds that is used ranges between 0 and the value of this property.

Other Periodic Service Scheduling Attributes

persistent attribute

Optional. Value type: boolean. Default value: false. Specifies whether scheduling should be maintained across system downtime.

If the value is false, scheduling of the start method restarts as if the periodic service instance has just transitioned to the online state after being enabled.

If the value of the persistent attribute is true and the value of the recover attribute (below) is false, scheduling of the start method for the instance emerging from downtime continues on the same schedule that was defined before the downtime occurred.

If the value of the persistent attribute is true and the value of the recover attribute is true, see the description of the recover attribute below.

recover attribute

Optional. Value type: boolean. Default value: false. Specifies whether the instance should have a recovery execution if an invocation was lost during system downtime.

This value has effect only if the value of the persistent attribute for this instance is true.

If the value of the persistent attribute is true and the value of the recover attribute is true, the periodic restarter invokes the start method for the instance as soon as possible as the instance emerges from system downtime. Subsequent invocations occur according to the period and jitter values.

If the value of the persistent property is true and the value of the recover property is false, see the description of the persistent property above.

Periodic Service Start Method Attributes and Context

exec attribute

Required. Value type: astring. The action to take, which must be suitable to pass to the exec system call. See the smf_method(5) man page.

This start method should perform a task and then terminate within the time specified by the period attribute.

The SMF_EXIT_TEMP_TRANSIENT exit code does not apply to periodic service start methods because the periodic restarter does not implement transient services. When used in a periodic service start method, the SMF_EXIT_TEMP_TRANSIENT exit code is treated the same as the SMF_EXIT_ERR_OTHER exit code.

Periodic service instances use only a start method. If any refresh or stop method is defined, a warning message is issued at manifest import and the refresh or stop method is ignored. When a periodic instance is refreshed, the periodic restarter rereads the values of the properties in the periodic property group described in Storing Periodic Service Data in the Service Configuration Repository. The periodic restarter does not need a stop method because processes contracted by a periodic instance do not run persistently. Periodic instances run short-lived processes and then wait until the next scheduled time to run.

timeout_seconds attribute

Optional. Value type: integer. The number of seconds to wait for the method action to complete. Use a value of 0 or -1 to specify an infinite timeout.

The timeout_seconds attribute value is required by the exec_method element. If you do not specify a value for the timeout_seconds attribute in this periodic_method element, the value for the exec_method element is assumed to be infinite. See Scheduling After Start Method Problems for a description of start method scheduling if the start method runs longer than the specified timeout_seconds value or if a contracted process still exists when the periodic restarter attempts to invoke the start method for the next period.

method_context element

Optional. See the Method Context section of the smf_method(5) man page.