Print this page
12071 clarify implementation of single_instance in SMF services
Reviewed by: Robert Mustacchi <rm@fingolfin.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1m/svc.startd.1m
          +++ new/usr/src/man/man1m/svc.startd.1m
   1    1  '\" te
   2    2  .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
   3      -.\" Copyright 2012, Joyent, Inc. All Rights Reserved.
        3 +.\" Copyright 2019 Joyent, Inc.
   4    4  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   5    5  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   6    6  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   7      -.TH SVC.STARTD 1M "Mar 18, 2011"
        7 +.TH SVC.STARTD 1M "Dec 11, 2019"
   8    8  .SH NAME
   9    9  svc.startd \- Service Management Facility master restarter
  10   10  .SH SYNOPSIS
  11      -.LP
  12   11  .nf
  13   12  \fB/lib/svc/bin/svc.startd\fR
  14   13  .fi
  15   14  
  16   15  .LP
  17   16  .nf
  18   17  \fBsvc:/system/svc/restarter:default\fR
  19   18  .fi
  20   19  
  21   20  .SH DESCRIPTION
  22      -.sp
  23      -.LP
  24   21  \fBsvc.startd\fR is the master restarter daemon for Service Management Facility
  25   22  (SMF) and the default restarter for all services. \fBsvc.startd\fR starts,
  26   23  stops, and restarts services based on administrative requests, system failures,
  27   24  or application failures.
  28   25  .sp
  29   26  .LP
  30   27  \fBsvc.startd\fR maintains service state, as well as being responsible for
  31   28  managing faults in accordance with the dependencies of each service.
  32   29  .sp
  33   30  .LP
↓ open down ↓ 3 lines elided ↑ open up ↑
  37   34  .sp
  38   35  .LP
  39   36  See \fBsmf_restarter\fR(5) for information on configuration and behavior common
  40   37  to all restarters.
  41   38  .sp
  42   39  .LP
  43   40  \fBsvcs\fR(1) reports status for all services managed by the Service
  44   41  Configuration Facility. \fBsvcadm\fR(1M) allows manipulation of service
  45   42  instances with respect to the service's restarter.
  46   43  .SS "Environment Variables"
  47      -.sp
  48      -.LP
  49   44  Environment variables with the "SMF_" prefix are reserved and may be
  50   45  overwritten.
  51   46  .sp
  52   47  .LP
  53   48  \fBsvc.startd\fR supplies the "SMF_" environment variables specified in
  54   49  \fBsmf_method\fR(5) to the method. PATH is set to "\fB/usr/sbin:/usr/bin\fR" by
  55   50  default. By default, all other environment variables supplied to
  56   51  \fBsvc.startd\fR are those inherited from \fBinit\fR(1M).
  57   52  .sp
  58   53  .LP
  59   54  Duplicate entries are reduced to a single entry. The value used is undefined.
  60   55  Environment entries that are not prefixed with "<\fIname\fR>=" are ignored.
  61   56  .SS "Restarter Options"
  62      -.sp
  63      -.LP
  64   57  \fBsvc.startd\fR is not configured by command line options. Instead,
  65   58  configuration is read from the service configuration repository. You can use
  66   59  \fBsvccfg\fR(1M) to set all options and properties.
  67   60  .sp
  68   61  .LP
  69   62  The following configuration variables in the \fBoptions\fR property group are
  70   63  available to developers and administrators:
  71   64  .sp
  72   65  .ne 2
  73   66  .na
↓ open down ↓ 78 lines elided ↑ open up ↑
 152  145  .sp
 153  146  This property is managed by \fBsvc.startd\fR and should not be modified by the
 154  147  administrator.
 155  148  .RE
 156  149  
 157  150  .sp
 158  151  .LP
 159  152  Configuration errors, such as disabling \fBsvc.startd\fR are logged by
 160  153  \fBsyslog\fR, but ignored.
 161  154  .SS "SERVICE STATES"
 162      -.sp
 163      -.LP
 164  155  Services managed by \fBsvc.startd\fR can appear in any of the states described
 165  156  in \fBsmf\fR(5). The state definitions are unmodified by this restarter.
 166  157  .SS "SERVICE REPORTING"
 167      -.sp
 168      -.LP
 169  158  In addition to any logging done by the managed service, \fBsvc.startd\fR
 170  159  provides a common set of service reporting and logging mechanisms.
 171  160  .sp
 172  161  .LP
 173  162  Reporting properties \fBsvc.startd\fR updates a common set of properties on all
 174  163  services it manages. These properties are a common interface that can be used
 175  164  to take action based on service instance health. The \fBsvcs\fR(1) command can
 176  165  be used to easily display these properties.
 177  166  .sp
 178  167  .ne 2
↓ open down ↓ 63 lines elided ↑ open up ↑
 242  231  .LP
 243  232  \fBLogs\fR
 244  233  .sp
 245  234  .LP
 246  235  By default, \fBsvc.startd\fR provides logging of significant restarter actions
 247  236  for the service as well as method standard output and standard error file
 248  237  descriptors to \fB/var/svc/log/\fIservice\fR:\fIinstance\fR.log\fR. The level
 249  238  of logging to system global locations like \fB/var/svc/log/svc.startd.log\fR
 250  239  and \fBsyslog\fR is controlled by the \fBoptions/logging\fR property.
 251  240  .SS "SERVICE DEFINITION"
 252      -.sp
 253      -.LP
 254  241  When developing or configuring a service managed by \fBsvc.startd\fR, a common
 255  242  set of properties are used to affect the interaction between the service
 256  243  instance and the restarter.
 257  244  .sp
 258  245  .LP
 259  246  \fBMethods\fR
 260  247  .sp
 261  248  .LP
 262  249  The general form of methods for the fork/exec model provided by
 263  250  \fBsvc.startd\fR are presented in \fBsmf_method\fR(5). The following methods
↓ open down ↓ 80 lines elided ↑ open up ↑
 344  331  available) for managing the service.
 345  332  .RE
 346  333  
 347  334  .sp
 348  335  .ne 2
 349  336  .na
 350  337  \fB\fBgeneral/single_instance\fR\fR
 351  338  .ad
 352  339  .sp .6
 353  340  .RS 4n
 354      -If \fBsingle_instance\fR is set to true, \fBsvc.startd\fR only allows one
 355      -instance of this service to transition to online or degraded at any time.
      341 +This was originally supposed to ensure that only one service instance could be
      342 +in online or degraded state at once; however, it was never implemented, and is
      343 +often incorrectly specified in multi-instance manifests. As such, it should be
      344 +considered obsolete and not specified in new manifests.
 356  345  .RE
 357  346  
 358  347  .sp
 359  348  .LP
 360  349  Additionally, \fBsvc.startd\fR managed services can define the optional
 361  350  properties listed below in the \fBstartd\fR property group.
 362  351  .sp
 363  352  .ne 2
 364  353  .na
 365  354  \fB\fBstartd/critical_failure_count\fR
↓ open down ↓ 53 lines elided ↑ open up ↑
 419  408  \fB\fBstartd/utmpx_prefix\fR\fR
 420  409  .ad
 421  410  .sp .6
 422  411  .RS 4n
 423  412  The \fButmpx_prefix\fR string property defines that the instance requires a
 424  413  valid \fButmpx\fR entry prior to start method execution. The default is not to
 425  414  create a \fButmpx\fR entry.
 426  415  .RE
 427  416  
 428  417  .SS "SERVICE FAILURE"
 429      -.sp
 430      -.LP
 431  418  \fBsvc.startd\fR assumes that a method has failed if it returns a non-zero exit
 432  419  code or if fails to complete before the timeout specified expires. If
 433  420  \fB$SMF_EXIT_ERR_CONFIG\fR or \fB$SMF_EXIT_ERR_FATAL\fR is returned,
 434  421  \fBsvc.startd\fR immediately places the service in the maintenance state. For
 435  422  all other failures, \fBsvc.startd\fR places the service in the offline state.
 436  423  If a service is offline and its dependencies are satisfied, \fBsvc.startd\fR
 437  424  tries again to start the service (see \fBsmf\fR(5)).
 438  425  .sp
 439  426  .LP
 440  427  If a contract or transient service does not return from its start method before
↓ open down ↓ 44 lines elided ↑ open up ↑
 485  472  conditions occurs.
 486  473  .sp
 487  474  .LP
 488  475  "\fBWait\fR" model services are restarted whenever the child process associated
 489  476  with the service exits. A child process that exits is not considered an error
 490  477  for "\fBwait\fR" model services, and repeated failures do not lead to a
 491  478  transition to maintenance state. However, a wait service which is repeatedly
 492  479  exiting with an error that exceeds the default rate (5 failures/second) will be
 493  480  throttled back so that the service only restarts once per second.
 494  481  .SS "LEGACY SERVICES"
 495      -.sp
 496      -.LP
 497  482  \fBsvc.startd\fR continues to provide support for services invoked during the
 498  483  startup run level transitions. Each \fB/etc/rc?.d\fR directory is processed
 499  484  after all managed services which constitute the equivalent run level milestone
 500  485  have transitioned to the online state. Standard \fBinit\fR scripts placed in
 501  486  the \fB/etc/rc?.d\fR directories are run in the order of their sequence
 502  487  numbers.
 503  488  .sp
 504  489  .LP
 505  490  The milestone to run-level mapping is:
 506  491  .sp
↓ open down ↓ 28 lines elided ↑ open up ↑
 535  520  
 536  521  .sp
 537  522  .LP
 538  523  Additionally, \fBsvc.startd\fR gives these legacy services visibility in SMF by
 539  524  inserting an instance per script into the repository. These legacy instances
 540  525  are visible using standard SMF interfaces such as \fBsvcs\fR(1), always appear
 541  526  in the \fBLEGACY-RUN\fR state, cannot be modified, and can not be specified as
 542  527  dependencies of other services. The initial start time of the legacy service is
 543  528  captured as a convenience for the administrator.
 544  529  .SH FILES
 545      -.sp
 546  530  .ne 2
 547  531  .na
 548  532  \fB\fB/var/svc/log\fR\fR
 549  533  .ad
 550  534  .RS 21n
 551  535  Directory where \fBsvc.startd\fR stores log files.
 552  536  .RE
 553  537  
 554  538  .sp
 555  539  .ne 2
 556  540  .na
 557  541  \fB\fB/etc/svc/volatile\fR\fR
 558  542  .ad
 559  543  .RS 21n
 560  544  Directory where \fBsvc.startd\fR stores log files in early stages of boot,
 561  545  before \fB/var\fR is mounted read-write.
 562  546  .RE
 563  547  
 564  548  .SH EXAMPLE
 565      -.LP
 566  549  \fBExample 1 \fRTurning on Verbose Logging
 567  550  .sp
 568  551  .LP
 569  552  To turn on verbose logging, type the following:
 570  553  
 571  554  .sp
 572  555  .in +2
 573  556  .nf
 574  557  # /usr/sbin/svccfg -s system/svc/restarter:default
 575  558  svc:/system/svc/restarter:default> addpg options application
↓ open down ↓ 2 lines elided ↑ open up ↑
 578  561  svc:/system/svc/restarter:default> exit
 579  562  .fi
 580  563  .in -2
 581  564  .sp
 582  565  
 583  566  .sp
 584  567  .LP
 585  568  This request will take effect on the next restart of \fBsvc.startd\fR.
 586  569  
 587  570  .SH SEE ALSO
 588      -.sp
 589      -.LP
 590  571  \fBsvcs\fR(1), \fBsvcprop\fR(1), \fBkernel\fR(1M), \fBinit\fR(1M),
 591  572  \fBsvcadm\fR(1M), \fBsvccfg\fR(1M), \fBsvc.configd\fR(1M), \fBsetsid\fR(2),
 592  573  \fBsyslog\fR(3C), \fBlibscf\fR(3LIB), \fBscf_value_is_type\fR(3SCF),
 593  574  \fBcontract\fR(4), \fBinit.d\fR(4), \fBprocess\fR(4), \fBinittab\fR(4),
 594  575  \fBattributes\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX