The periodic_method element can be specified within a service element or within an instance element. The periodic_method element specifies both start method and scheduling information for periodic services and can have the attributes and elements that are described in this section. The period and exec attributes are required.
Example 3 Periodic Service periodic_method ElementThe following example shows the periodic_method element in a periodic service. In this example, the periodic restarter executes /usr/bin/periodic-ex every day: every 86400-86460 seconds.
<periodic_method period='86400' jitter='60' persistent='true' exec='/usr/bin/periodic-ex' timeout_seconds='0'> <method_context> <method_credential user='root' group='root' /> </method_context> </periodic_method>
For svcprop and svccfg, the following attributes of the periodic_method element are accessed as properties in the periodic property group.
The units for a time value are seconds, as shown in Figure 2, Table 2, Service Property Type Value Descriptions.
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.
Required. Value type: time. The number of seconds between invocations of the start method.
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.
For svcprop and svccfg, the following attributes of the periodic_method element are accessed as properties in the periodic property group.
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.
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.
For svcprop and svccfg, the following attributes of the periodic_method element and properties specified in the method_context element are accessed as properties in the start property group.
Required. Value type: astring. The start method for the periodic service. The start method actions must be suitable to pass to the exec system call. See the smf_method(7) man page and the exec(2) 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.
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 periodic_method element. If you do not specify a value for the timeout_seconds attribute in the periodic_method element, the value for timeout_seconds 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.
Optional. The context in which the start method will run. See the method_credential element in Securing Service Tasks, and see the Method Context section of the smf_method(7) man page.