SVC.STARTD(1M) | Maintenance Commands | SVC.STARTD(1M) |
/lib/svc/bin/svc.startd
svc:/system/svc/restarter:default
svc.startd maintains service state, as well as being responsible for managing faults in accordance with the dependencies of each service.
svc.startd is invoked automatically during system startup. It is restarted if any failures occur. svc.startd should never be invoked directly.
See smf_restarter(5) for information on configuration and behavior common to all restarters.
svcs(1) reports status for all services managed by the Service Configuration Facility. svcadm(1M) allows manipulation of service instances with respect to the service's restarter.
svc.startd supplies the "SMF_" environment variables specified in smf_method(5) to the method. PATH is set to "/usr/sbin:/usr/bin" by default. By default, all other environment variables supplied to svc.startd are those inherited from init(1M).
Duplicate entries are reduced to a single entry. The value used is undefined. Environment entries that are not prefixed with "<name>=" are ignored.
The following configuration variables in the options property group are available to developers and administrators:
boot_messages
logging
milestone
svc:/milestone/single-user:default svc:/milestone/multi-user:default svc:/milestone/multi-user-server:default
or the special values all or none. all represents an idealized milestone that depends on every service. none is a special milestone where no services are running apart from the master svc:/system/svc/restarter:default. By default, svc.startd uses all, a synthetic milestone that depends on every service. If this property is specified, it overrides any initdefault setting in inittab(4).
system/reconfigure
This property is managed by svc.startd and should not be modified by the administrator.
Configuration errors, such as disabling svc.startd are logged by syslog, but ignored.
Reporting properties svc.startd updates a common set of properties on all services it manages. These properties are a common interface that can be used to take action based on service instance health. The svcs(1) command can be used to easily display these properties.
restarter/state
restarter/next_state
restarter/auxiliary_state
maintenance
fault_threshold_reached stop_method_failed administrative_request
restarter/state_timestamp
restarter/contract
Logs
By default, svc.startd provides logging of significant restarter actions for the service as well as method standard output and standard error file descriptors to /var/svc/log/service:instance.log. The level of logging to system global locations like /var/svc/log/svc.startd.log and syslog is controlled by the options/logging property.
Methods
The general form of methods for the fork/exec model provided by svc.startd are presented in smf_method(5). The following methods are supported as required or optional by services managed by svc.startd.
refresh
This method is optional.
start
This method is required.
stop
This method is required.
If the service does not need to take any action in a required method, it must specify the :true token for that method.
svc.startd honors any method context specified for the service or any specific method. The method expansion tokens described in smf_method(5) are available for use in all methods invoked by svc.startd.
Properties
An overview of the general properties is available in smf(5). The specific way in which these general properties interacts with svc.startd follows:
general/enabled
general/restarter
general/single_instance
Additionally, svc.startd managed services can define the optional properties listed below in the startd property group.
startd/critical_failure_count
startd/critical_failure_period
startd/duration
startd/ignore_error
startd/need_session
startd/utmpx_prefix
If a contract or transient service does not return from its start method before its defined timeout elapses, svc.startd sends a SIGKILL to the method, and returns the service to the offline state.
If three failures happen in a row, or if the service is restarting more than once a second, svc.startd places the service in the maintenance state.
The conditions of service failure are defined by a combination of the service model (defined by the startd/duration property) and the value of the startd/ignore_error property.
A contract model service fails if any of the following conditions occur:
The last two conditions may be ignored by the service by specifying core and/or signal in startd/ignore_error.
Defining a service as transient means that svc.startd does not track processes for that service. Thus, the potential faults described for contract model services are not considered failures for transient services. A transient service only enters the maintenance state if one of the method failure conditions occurs.
"Wait" model services are restarted whenever the child process associated with the service exits. A child process that exits is not considered an error for "wait" model services, and repeated failures do not lead to a transition to maintenance state. However, a wait service which is repeatedly exiting with an error that exceeds the default rate (5 failures/second) will be throttled back so that the service only restarts once per second.
The milestone to run-level mapping is:
milestone/single-user
milestone/multi-user
milestone/multi-user-server
Additionally, svc.startd gives these legacy services visibility in SMF by inserting an instance per script into the repository. These legacy instances are visible using standard SMF interfaces such as svcs(1), always appear in the LEGACY-RUN state, cannot be modified, and can not be specified as dependencies of other services. The initial start time of the legacy service is captured as a convenience for the administrator.
/etc/svc/volatile
To turn on verbose logging, type the following:
# /usr/sbin/svccfg -s system/svc/restarter:default svc:/system/svc/restarter:default> addpg options application svc:/system/svc/restarter:default> setprop options/logging = \ astring: verbose svc:/system/svc/restarter:default> exit
This request will take effect on the next restart of svc.startd.
December 11, 2019 |