Managing System Services in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Showing Whether a Service Will Automatically Restart

A running service can be configured to restart when one of its dependencies is stopped or refreshed. If dependencies of a running service (online or degraded state) are not satisfied, the service transitions to the offline state. If a service restarts after a dependency stop or refresh, dependencies might again be satisfied and the dependent service transitioned back to a running state.

The following factors determine whether a service is restarted after a require_all, require_any, or optional_all dependency is stopped or refreshed:

  • Whether the dependency was stopped or refreshed. If stopped, whether the dependency was stopped because of an error such as a hardware error or a core dump or for some other reason such as an administrative action.

  • The value of the restart_on attribute of the dependency. Possible values are none, error, restart, and refresh.

As shown in the following table, if the value of the restart_on attribute of the dependency is none, the dependent service is not restarted when the dependency is stopped or refreshed. If the value of the restart_on attribute of the dependency is refresh, the dependent service is always restarted when the dependency is stopped or refreshed. If the value of restart_on is error, the dependent service is only restarted if the dependency stopped because of an error. If the value of restart_on is restart, the dependent service is only restarted if the dependency was refreshed.

Table 2-1  Automatically Restarting a Service After a Dependency Stop
require_all, require_any, or optional_all Dependency
Value of Dependency restart_on Attribute
Stop or Refresh Event
none
error
restart
refresh
Stop due to error
No restart
Restart
No restart
Restart
Other stop
No restart
No restart
No restart
Restart
Refresh
No restart
No restart
Restart
Restart

Listing Instances That a Service Depends On shows that the system-repository service has two require_all dependencies and one optional_all dependency. The following command shows that the system-repository service will be restarted if the milestone/network service or the system/filesystem/autofs service stops due to an error but not if they stop for any other reason or are refreshed. The system-repository service will not be restarted if the system/filesystem/local service is refreshed or stopped for any reason.

$ svccfg -s system-repository:default listprop -o propname,propval '*restart_on'
network/restart_on          astring     error
filesystem-local/restart_on astring     none
autofs/restart_on           astring     error