Print this page
NEX-3510 Want "scripted" mode for svcs(1)
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
   1 '\" te
















   2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
   3 .\" 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.
   4 .\" 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.
   5 .\" 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]
   6 .TH SVCS 1 "Apr 17, 2011"
   7 .SH NAME
   8 svcs \- report service status
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 \fBsvcs\fR [\fB-aHpv?\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] [\fB-o\fR \fIcol\fR[,\fIcol\fR]]... [\fB-R\fR \fIFMRI-instance\fR]...
  13      [\fB-sS\fR \fIcol\fR]... [\fIFMRI\fR | \fIpattern\fR]...
  14 .fi
  15 
  16 .LP
  17 .nf
  18 \fBsvcs\fR {\fB-d\fR | \fB-D\fR} [\fB-Hpv?\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] [\fB-o\fR \fIcol\fR[,\fIcol\fR]]... [\fB-sS\fR \fIcol\fR]...
  19      [\fIFMRI\fR | \fIpattern\fR] ...
  20 .fi
  21 
  22 .LP
  23 .nf
  24 \fBsvcs\fR [\fB-l\fR | \fB-L\fR] [\fB-vZ\fR] [\fB-z\fR \fIzone\fR] [\fIFMRI\fR | \fIpattern\fR]...
  25 .fi
  26 
  27 .LP
  28 .nf
  29 \fBsvcs\fR \fB-x\fR [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] [\fIFMRI\fR]...
  30 .fi
  31 
  32 .SH DESCRIPTION
  33 .sp
  34 .LP
  35 The \fBsvcs\fR command displays information about service instances as recorded
  36 in the service configuration repository.
  37 .sp
  38 .LP



  39 The first form of this command prints one-line status listings for service
  40 instances specified by the arguments. Each instance is listed only once. With
  41 no arguments, all enabled service instances, even if temporarily disabled, are
  42 listed with the columns indicated below.
  43 .sp
  44 .LP
  45 The second form prints one-line status listings for the dependencies or
  46 dependents of the service instances specified by the arguments.
  47 .sp
  48 .LP
  49 The third form prints detailed information about specific services and
  50 instances.
  51 .sp
  52 .LP
  53 The fourth form explains the states of service instances. For each argument, a
  54 block of human-readable text is displayed which explains what state the service
  55 is in, and why it is in that state. With no arguments, problematic services are
  56 described.
  57 .sp
  58 .LP
  59 Error messages are printed to the standard error stream.
  60 .sp
  61 .LP
  62 The output of this command can be used appropriately as input to the
  63 \fBsvcadm\fR(1M) command.
  64 .SH OPTIONS
  65 .sp
  66 .LP
  67 The following options are supported:
  68 .sp
  69 .ne 2
  70 .na
  71 \fB\fB-?\fR\fR
  72 .ad
  73 .RS 20n
  74 Displays an extended usage message, including column specifiers.
  75 .RE
  76 
  77 .sp
  78 .ne 2
  79 .na
  80 \fB\fB-a\fR\fR
  81 .ad
  82 .RS 20n
  83 Show all services, even disabled ones. This option has no effect if services
  84 are selected.
  85 .RE
  86 
  87 .sp
  88 .ne 2
  89 .na
  90 \fB\fB-d\fR\fR
  91 .ad
  92 .RS 20n
  93 Lists the services or service instances upon which the given service instances
  94 depend.
  95 .RE
  96 
  97 .sp
  98 .ne 2
  99 .na
 100 \fB\fB-D\fR\fR
 101 .ad
 102 .RS 20n
 103 Lists the service instances that depend on the given services or service
 104 instances.
 105 .RE
 106 
 107 .sp
 108 .ne 2
 109 .na
 110 \fB\fB-H\fR\fR
 111 .ad
 112 .RS 20n
 113 Omits the column headers.
 114 .RE
 115 
 116 .sp
 117 .ne 2
 118 .na
 119 \fB\fB-l\fR\fR
 120 .ad
 121 .RS 20n
 122 (The letter ell.) Displays all available information about the selected
 123 services and service instances, with one service attribute displayed for each
 124 line. Information for different instances are separated by blank lines.
 125 .sp
 126 The following specific attributes require further explanation:
 127 .sp
 128 .ne 2
 129 .na
 130 \fB\fBdependency\fR\fR
 131 .ad
 132 .RS 14n
 133 Information about a dependency. The grouping and \fBrestart_on\fR properties
 134 are displayed first and are separated by a forward slash (\fB/\fR). Next, each
 135 entity and its state is listed. See \fBsmf\fR(5) for information about states.


 136 In addition to the standard states, each service dependency can have the
 137 following state descriptions:
 138 .sp
 139 .ne 2
 140 .na
 141 \fB\fBabsent\fR\fR
 142 .ad
 143 .RS 12n
 144 No such service is defined on the system.
 145 .RE
 146 
 147 .sp
 148 .ne 2
 149 .na
 150 \fB\fBinvalid\fR\fR
 151 .ad
 152 .RS 12n
 153 The fault management resource identifier (FMRI) is invalid (see \fBsmf\fR(5)).
 154 .RE
 155 
 156 .sp
 157 .ne 2
 158 .na
 159 \fB\fBmultiple\fR\fR
 160 .ad
 161 .RS 12n
 162 The entity is a service with multiple instances.
 163 .RE
 164 
 165 File dependencies can only have one of the following state descriptions:
 166 .sp
 167 .ne 2
 168 .na
 169 \fB\fBabsent\fR\fR
 170 .ad
 171 .RS 11n
 172 No such file on the system.
 173 .RE
 174 
 175 .sp
 176 .ne 2
 177 .na
 178 \fB\fBonline\fR\fR
 179 .ad
 180 .RS 11n
 181 The file exists.
 182 .sp
 183 If the file did not exist the last time that \fBsvc.startd\fR evaluated the
 184 service's dependencies, it can consider the dependency to be unsatisfied.
 185 \fBsvcadm refresh\fR forces dependency re-evaluation.
 186 .RE
 187 
 188 .sp
 189 .ne 2
 190 .na
 191 \fB\fBunknown\fR\fR
 192 .ad
 193 .RS 11n
 194 \fBstat\fR(2) failed for a reason other than \fBENOENT\fR.
 195 .RE
 196 
 197 See \fBsmf\fR(5) for additional details about dependencies, grouping, and
 198 \fBrestart_on\fR values.
 199 .RE
 200 
 201 .sp
 202 .ne 2
 203 .na
 204 \fB\fBenabled\fR\fR
 205 .ad
 206 .RS 14n
 207 Whether the service is enabled or not, and whether it is enabled or disabled
 208 temporarily (until the next system reboot). The former is specified as either
 209 \fBtrue\fR or \fBfalse\fR, and the latter is designated by the presence of
 210 \fB(temporary)\fR.
 211 .sp





 212 A service might be temporarily disabled because an administrator has run
 213 \fBsvcadm disable -t\fR, used \fBsvcadm milestone\fR, or booted the system to a
 214 specific milestone. See \fBsvcadm\fR(1M) for details.
 215 .RE
 216 
 217 .RE
 218 
 219 .sp
 220 .ne 2
 221 .na
 222 \fB-L\fR
 223 .ad
 224 .RS 20n
 225 Display the log file of the selected services and service instances, one
 226 per-line.
 227 .RE
 228 
 229 .sp
 230 .ne 2
 231 .na
 232 \fB\fB-o\fR \fIcol\fR[,\fIcol\fR]...\fR
 233 .ad
 234 .RS 20n
 235 Prints the specified columns. Each \fIcol\fR should be a column name. See
 236 \fBCOLUMNS\fR below for available columns.
 237 .RE
 238 
 239 .sp
 240 .ne 2
 241 .na
 242 \fB\fB-p\fR\fR
 243 .ad
 244 .RS 20n
 245 Lists processes associated with each service instance. A service instance can
 246 have no associated processes. The process ID, start time, and command name
 247 (\fBPID\fR, \fBSTIME\fR, and \fBCMD\fR fields from \fBps\fR(1)) are displayed
 248 for each process.
 249 .RE
 250 
 251 .sp
 252 .ne 2
 253 .na
 254 \fB\fB-R\fR \fIFMRI-instance\fR\fR
 255 .ad
 256 .RS 20n
 257 Selects service instances that have the given service instance as their
 258 restarter.
 259 .RE
 260 
 261 .sp
 262 .ne 2
 263 .na
 264 \fB\fB-s\fR \fIcol\fR\fR
 265 .ad
 266 .RS 20n
 267 Sorts output by column. \fIcol\fR should be a column name. See \fBCOLUMNS\fR
 268 below for available columns. Multiple \fB-s\fR options behave additively.
 269 .RE
 270 
 271 .sp
 272 .ne 2
 273 .na
 274 \fB\fB-S\fR \fIcol\fR\fR
 275 .ad
 276 .RS 20n
 277 Sorts by \fIcol\fR in the opposite order as option \fB-s\fR.
 278 .RE
 279 
 280 .sp
 281 .ne 2
 282 .na
 283 \fB\fB-v\fR\fR
 284 .ad
 285 .RS 20n
 286 Without \fB-x\fR or \fB-l\fR, displays verbose columns: \fBSTATE\fR,
 287 \fBNSTATE\fR, \fBSTIME\fR, \fBCTID\fR, and \fBFMRI\fR.
 288 .sp
 289 With \fB-x\fR, displays extra information for each explanation.
 290 .sp
 291 With \fB-l\fR, displays user-visible properties in property groups of type
 292 \fBapplication\fR and their description.
 293 .RE
 294 
 295 .sp
 296 .ne 2
 297 .na
 298 \fB\fB-x\fR\fR
 299 .ad
 300 .RS 20n
 301 Displays explanations for service states.
 302 .sp
 303 Without arguments, the \fB-x\fR option explains the states of services which:
 304 .RS +4
 305 .TP
 306 .ie t \(bu
 307 .el o
 308 are enabled, but are not running.
 309 .RE
 310 .RS +4
 311 .TP
 312 .ie t \(bu
 313 .el o
 314 are preventing another enabled service from running.
 315 .RE
 316 .RE
 317 
 318 .sp
 319 .ne 2
 320 .na
 321 \fB-z \fIzone\fR
 322 .ad
 323 .RS 20n
 324 Display only the services in the \fIzone\fR.  This option is only applicable
 325 in the global zone, see \fBzones\fR(5).
 326 .RE
 327 
 328 .sp
 329 .ne 2
 330 .na
 331 \fB-Z\fR
 332 .ad
 333 .RS 20n
 334 Display services from all zones, with an additional column indicating in which
 335 zone the service is running.  This option is only applicable in the global
 336 zone, see \fBzones\fR(5).
 337 .RE
 338 
 339 .SH OPERANDS
 340 .sp
 341 .LP
 342 The following operands are supported:
 343 .sp
 344 .ne 2
 345 .na
 346 \fB\fIFMRI\fR\fR
 347 .ad
 348 .RS 17n
 349 A fault management resource identifier (FMRI) that specifies one or more
 350 instances (see \fBsmf\fR(5)). FMRIs can be abbreviated by specifying the
 351 instance name, or the trailing portion of the service name. For example, given
 352 the FMRI:
 353 .sp
 354 .in +2
 355 .nf
 356 svc:/network/smtp:sendmail
 357 .fi
 358 .in -2
 359 .sp
 360 
 361 The following are valid abbreviations:
 362 .sp
 363 .in +2
 364 .nf
 365 sendmail
 366 :sendmail
 367 smtp
 368 smtp:sendmail
 369 network/smtp
 370 .fi
 371 .in -2
 372 .sp
 373 
 374 The following are invalid abbreviations:
 375 .sp
 376 .in +2
 377 .nf
 378 mail
 379 network
 380 network/smt
 381 .fi
 382 .in -2
 383 .sp
 384 
 385 If the FMRI specifies a service, then the command applies to all instances of
 386 that service, except when used with the \fB-D\fR option.
 387 .sp


 388 Abbreviated forms of FMRIs are unstable, and should not be used in scripts or
 389 other permanent tools.
 390 .RE
 391 
 392 .sp
 393 .ne 2
 394 .na
 395 \fB\fIpattern\fR\fR
 396 .ad
 397 .RS 17n
 398 A pattern that is matched against the \fIFMRI\fRs of service instances
 399 according to the "globbing" rules described by \fBfnmatch\fR(5). If the pattern
 400 does not begin with \fBsvc:\fR, then \fBsvc:/\fR is prepended. The following is
 401 a typical example of a glob pattern:
 402 .sp
 403 .in +2
 404 .nf
 405 qexample% svcs \e*keyserv\e*
 406 STATE          STIME     FMRI
 407 disabled       Aug_02    svc:/network/rpc/keyserv:default
 408 .fi
 409 .in -2
 410 .sp
 411 
 412 .RE
 413 
 414 .sp
 415 .ne 2
 416 .na
 417 \fB\fIFMRI-instance\fR\fR
 418 .ad
 419 .RS 17n
 420 An FMRI that specifies an instance.
 421 .RE
 422 
 423 .SH COLUMNS
 424 .sp
 425 .LP
 426 Column names are case insensitive. The default output format is equivalent to
 427 "\fB-o\fR \fBstate,stime,fmri\fR". The default sorting columns are \fBSTATE\fR,
 428 \fBSTIME\fR, \fBFMRI\fR.
 429 .sp
 430 .ne 2
 431 .na
 432 \fB\fBCTID\fR\fR
 433 .ad
 434 .RS 10n
 435 The primary contract ID for the service instance. Not all instances have valid
 436 primary contract IDs.
 437 .RE
 438 
 439 .sp
 440 .ne 2
 441 .na
 442 \fB\fBDESC\fR\fR
 443 .ad
 444 .RS 10n
 445 A brief description of the service, from its template element. A service might
 446 not have a description available, in which case a hyphen (\fB\(hy\fR) is used
 447 to denote an empty value.
 448 .RE
 449 
 450 .sp
 451 .ne 2
 452 .na
 453 \fB\fBFMRI\fR\fR
 454 .ad
 455 .RS 10n
 456 The \fIFMRI\fR of the service instance.
 457 .RE
 458 
 459 .sp
 460 .ne 2
 461 .na
 462 \fB\fBINST\fR\fR
 463 .ad
 464 .RS 10n
 465 The instance name of the service instance.
 466 .RE
 467 
 468 .sp
 469 .ne 2
 470 .na
 471 \fB\fBNSTA\fR\fR
 472 .ad
 473 .RS 10n
 474 The abbreviated next state of the service instance, as given in the \fBSTA\fR
 475 column description. A hyphen denotes that the instance is not transitioning.
 476 Same as \fBSTA\fR otherwise.
 477 .RE
 478 
 479 .sp
 480 .ne 2
 481 .na
 482 \fB\fBNSTATE\fR\fR
 483 .ad
 484 .RS 10n
 485 The next state of the service. A hyphen is used to denote that the instance is
 486 not transitioning. Same as \fBSTATE\fR otherwise.
 487 .RE
 488 
 489 .sp
 490 .ne 2
 491 .na
 492 \fB\fBSCOPE\fR\fR
 493 .ad
 494 .RS 10n
 495 The scope name of the service instance.
 496 .RE
 497 
 498 .sp
 499 .ne 2
 500 .na
 501 \fB\fBSVC\fR\fR
 502 .ad
 503 .RS 10n
 504 The service name of the service instance.
 505 .RE
 506 
 507 .sp
 508 .ne 2
 509 .na
 510 \fB\fBSTA\fR\fR
 511 .ad
 512 .RS 10n
 513 The abbreviated state of the service instance (see \fBsmf\fR(5)):
 514 .sp
 515 .ne 2
 516 .na
 517 \fB\fBDGD\fR\fR
 518 .ad
 519 .RS 7n
 520 degraded
 521 .RE
 522 
 523 .sp
 524 .ne 2
 525 .na
 526 \fB\fBDIS\fR\fR
 527 .ad
 528 .RS 7n
 529 disabled
 530 .RE
 531 
 532 .sp
 533 .ne 2
 534 .na
 535 \fB\fBLRC\fR\fR
 536 .ad
 537 .RS 7n
 538 legacy \fBrc*.d\fR script-initiated instance
 539 .RE
 540 
 541 .sp
 542 .ne 2
 543 .na
 544 \fB\fBMNT\fR\fR
 545 .ad
 546 .RS 7n
 547 maintenance
 548 .RE
 549 
 550 .sp
 551 .ne 2
 552 .na
 553 \fB\fBOFF\fR\fR
 554 .ad
 555 .RS 7n
 556 offline
 557 .RE
 558 
 559 .sp
 560 .ne 2
 561 .na
 562 \fB\fBON\fR\fR
 563 .ad
 564 .RS 7n
 565 online
 566 .RE
 567 
 568 .sp
 569 .ne 2
 570 .na
 571 \fB\fBUN\fR\fR
 572 .ad
 573 .RS 7n
 574 uninitialized
 575 .RE
 576 
 577 Absent or unrecognized states are denoted by a question mark (\fB?\fR)
 578 character. An asterisk (\fB*\fR) is appended for instances in transition,
 579 unless the \fBNSTA\fR or \fBNSTATE\fR column is also being displayed.
 580 .sp
 581 See \fBsmf\fR(5) for an explanation of service states.
 582 .RE
 583 
 584 .sp
 585 .ne 2
 586 .na
 587 \fB\fBSTATE\fR\fR
 588 .ad
 589 .RS 10n
 590 The state of the service instance. An asterisk is appended for instances in
 591 transition, unless the \fBNSTA\fR or \fBNSTATE\fR column is also being
 592 displayed.
 593 .sp
 594 See \fBsmf\fR(5) for an explanation of service states.
 595 .RE
 596 
 597 .sp
 598 .ne 2
 599 .na
 600 \fB\fBSTIME\fR\fR
 601 .ad
 602 .RS 10n
 603 If the service instance entered the current state within the last 24 hours,
 604 this column indicates the time that it did so. Otherwise, this column indicates
 605 the date on which it did so, printed with underscores (\fB_\fR) in place of
 606 blanks.
 607 .RE
 608 
 609 .SH EXAMPLES
 610 .LP
 611 \fBExample 1 \fRDisplaying the Default Output
 612 .sp
 613 .LP









 614 This example displays default output:
 615 
 616 .sp
 617 .in +2
 618 .nf
 619 example% svcs
 620 STATE          STIME    FMRI
 621 \&...
 622 legacy_run     13:25:04 lrc:/etc/rc3_d/S42myscript
 623 \&...
 624 online         13:21:50 svc:/system/svc/restarter:default
 625 \&...
 626 online         13:25:03 svc:/milestone/multi-user:default
 627 \&...
 628 online         13:25:07 svc:/milestone/multi-user-server:default
 629 \&...
 630 .fi
 631 .in -2
 632 .sp
 633 
 634 .LP
 635 \fBExample 2 \fRListing All Local Instances
 636 .sp
 637 .LP
 638 This example lists all local instances of the \fBservice1\fR service.
 639 
 640 .sp
 641 .in +2
 642 .nf
 643 example% svcs -o state,nstate,fmri service1
 644 STATE        NSTATE        FMRI
 645 online       -             svc:/service1:instance1
 646 disabled     -             svc:/service1:instance2
 647 .fi
 648 .in -2
 649 .sp
 650 
 651 .LP
 652 \fBExample 3 \fRListing Verbose Information
 653 .sp
 654 .LP
 655 This example lists verbose information.
 656 
 657 .sp
 658 .in +2
 659 .nf
 660 example% svcs -v network/rpc/rstat:udp
 661 STATE          NSTATE        STIME    CTID   FMRI
 662 online         -             Aug_09        - svc:/network/rpc/rstat:udp
 663 .fi
 664 .in -2
 665 .sp
 666 
 667 .LP
 668 \fBExample 4 \fRListing Detailed Information
 669 .sp
 670 .LP
 671 This example lists detailed information about all instances of
 672 \fBsystem/service3\fR. Additional fields can be displayed, as appropriate to
 673 the managing restarter.
 674 
 675 .sp
 676 .in +2
 677 .nf
 678 example% svcs -l network/rpc/rstat:udp
 679 
 680 fmri         svc:/network/rpc/rstat:udp
 681 enabled      true
 682 state        online
 683 next_state   none
 684 restarter    svc:/network/inetd:default
 685 contract_id
 686 dependency   require_all/error svc:/network/rpc/bind (online)
 687 .fi
 688 .in -2
 689 .sp
 690 
 691 .LP
 692 \fBExample 5 \fRListing Processes
 693 .sp
 694 .in +2
 695 .nf
 696 example% svcs -p sendmail
 697 STATE          STIME    FMRI
 698 online         13:25:13 svc:/network/smtp:sendmail
 699                13:25:15   100939 sendmail
 700 13:25:15   100940 sendmail
 701 .fi
 702 .in -2
 703 .sp
 704 
 705 .LP
 706 \fBExample 6 \fRExplaining Service States Using \fBsvcs\fR \fB-x\fR
 707 .sp
 708 .LP
 709 (a) In this example, \fBsvcs\fR \fB-x\fR has identified that the print/server
 710 service being disabled is the root cause of two services which are enabled but
 711 not online. \fBsvcs\fR \fB-xv\fR shows that those services are
 712 \fBprint/rfc1179\fR and \fBprint/ipp-listener\fR. This situation can be
 713 rectified by either enabling \fBprint/server\fR or disabling \fBrfc1179\fR and
 714 \fBipp-listener\fR.
 715 
 716 .sp
 717 .in +2
 718 .nf





 719 example% svcs -x
 720 svc:/application/print/server:default (LP print server)
 721  State: disabled since Mon Feb 13 17:56:21 2006
 722 Reason: Disabled by an administrator.
 723    See: http://illumos.org/msg/SMF-8000-05
 724    See: lpsched(1M)
 725 Impact: 2 dependent services are not running. (Use -v for list.)
 726 .fi
 727 .in -2
 728 .sp
 729 
 730 .sp
 731 .LP
 732 (b) In this example, NFS is not working:
 733 
 734 .sp
 735 .in +2
 736 .nf
 737 example$ svcs nfs/client
 738 STATE          STIME    FMRI
 739 offline        16:03:23 svc:/network/nfs/client:default
 740 .fi
 741 .in -2
 742 .sp
 743 
 744 .sp
 745 .LP
 746 (c) The following example shows that the problem is \fBnfs/status\fR.
 747 \fBnfs/client\fR is waiting because it depends on \fBnfs/nlockmgr\fR, which
 748 depends on \fBnfs/status\fR:
 749 
 750 .sp
 751 .in +2
 752 .nf
 753 example$ svcs -xv nfs/client
 754 svc:/network/nfs/client:default (NFS client)
 755  State: offline since Mon Feb 27 16:03:23 2006
 756 Reason: Service svc:/network/nfs/status:default
 757         is not running because a method failed repeatedly.
 758    See: http://illumos.org/msg/SMF-8000-GE
 759   Path: svc:/network/nfs/client:default
 760           svc:/network/nfs/nlockmgr:default
 761             svc:/network/nfs/status:default
 762    See: man -M /usr/share/man -s 1M mount_nfs
 763    See: /var/svc/log/network-nfs-client:default.log
 764 Impact: This service is not running.
 765 .fi
 766 .in -2
 767 .sp
 768 
 769 .SH EXIT STATUS
 770 .sp
 771 .LP
 772 The following exit values are returned:
 773 .sp
 774 .ne 2
 775 .na
 776 \fB\fB0\fR\fR
 777 .ad
 778 .RS 5n
 779 Successful command invocation.
 780 .RE
 781 
 782 .sp
 783 .ne 2
 784 .na
 785 \fB\fB1\fR\fR
 786 .ad
 787 .RS 5n
 788 Fatal error.
 789 .RE
 790 
 791 .sp
 792 .ne 2
 793 .na
 794 \fB\fB2\fR\fR
 795 .ad
 796 .RS 5n
 797 Invalid command line options were specified.
 798 .RE
 799 
 800 .SH ATTRIBUTES
 801 .sp
 802 .LP
 803 See \fBattributes\fR(5) for descriptions of the following attributes:
 804 .sp
 805 
 806 .sp
 807 .TS
 808 box;
 809 c | c
 810 l | l .
 811 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 812 _
 813 Interface Stability     See below.
 814 .TE
 815 
 816 .sp
 817 .LP
 818 Screen output is Uncommitted. The invocation is Committed.
 819 .SH SEE ALSO
 820 .sp
 821 .LP
 822 \fBps\fR(1), \fBsvcprop\fR(1), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M),
 823 \fBsvc.startd\fR(1M), \fBstat\fR(2), \fBlibscf\fR(3LIB), \fBattributes\fR(5),
 824 \fBfnmatch\fR(5), \fBsmf\fR(5), \fBzones\fR(5)
   1 .\"
   2 .\" The contents of this file are subject to the terms of the
   3 .\" Common Development and Distribution License (the "License").
   4 .\" You may not use this file except in compliance with the License.
   5 .\"
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   7 .\" or http://www.opensolaris.org/os/licensing.
   8 .\" See the License for the specific language governing permissions
   9 .\" and limitations under the License.
  10 .\"
  11 .\" When distributing Covered Code, include this CDDL HEADER in each
  12 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  13 .\" If applicable, add the following below this CDDL HEADER, with the
  14 .\" fields enclosed by brackets "[]" replaced with your own identifying
  15 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  16 .\"
  17 .\"
  18 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
  19 .\" Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  20 .\"
  21 .Dd April 23, 2015
  22 .Dt SVCS 1
  23 .Os
  24 .Sh NAME
  25 .Nm svcs
  26 .Nd report service status
  27 .Sh SYNOPSIS
  28 .Nm
  29 .Op Fl aHpv\?
  30 .Op Fl o Ar col Ns Oo , Ns Ar col Oc Ns ...
  31 .Oo Fl R Ar FMRI-instance Oc Ns ...
  32 .Oo Fl sS Ar col Oc Ns ...
  33 .Op Fl z Ar zone Ns | Ns Fl Z
  34 .Oo Ar FMRI Ns | Ns Ar pattern Oc Ns ...
  35 .Nm
  36 .Brq Fl d Ns | Ns Fl D
  37 .Fl Hpv\?
  38 .Op Fl o Ar col Ns Oo , Ns Ar col Oc Ns ...
  39 .Oo Fl sS Ar col Oc Ns ...
  40 .Op Fl z Ar zone Ns | Ns Fl Z
  41 .Oo Ar FMRI Ns | Ns Ar pattern Oc Ns ...
  42 .Nm
  43 .Brq Fl l Ns | Ns Fl L
  44 .Op Fl v
  45 .Op Fl z Ar zone Ns | Ns Fl Z
  46 .Bro Ar FMRI Ns |  Ns Ar pattern Brc Ns ...
  47 .Nm
  48 .Fl x
  49 .Op Fl v
  50 .Op Fl z Ar zone Ns | Ns Fl Z
  51 .Oo Ar FMRI Oc Ns ...
  52 .Sh DESCRIPTION
  53 The
  54 .Nm
  55 command displays information about service instances as recorded in the service
  56 configuration repository.
  57 .Pp
  58 The first form of this command prints one-line status listings for service
  59 instances specified by the arguments.
  60 Each instance is listed only once.
  61 With no arguments, all enabled service instances, even if temporarily disabled,
  62 are listed with the columns indicated below.
  63 .Pp
  64 The second form prints one-line status listings for the dependencies or
  65 dependents of the service instances specified by the arguments.
  66 .Pp

  67 The third form prints detailed information about specific services and
  68 instances.
  69 .Pp
  70 The fourth form explains the states of service instances.
  71 For each argument, a block of human-readable text is displayed which explains
  72 what state the service is in, and why it is in that state.
  73 With no arguments, problematic services are described.
  74 .Pp





  75 The output of this command can be used appropriately as input to the
  76 .Xr svcadm 1M
  77 command.
  78 .Sh OPTIONS

  79 The following options are supported:
  80 .Bl -tag -width "-R FMRI-instance"
  81 .It Fl \?




  82 Displays an extended usage message, including column specifiers.
  83 .It Fl a
  84 Show all services, even disabled ones.
  85 This option has no effect if services are selected.
  86 .It Fl d














  87 Lists the services or service instances upon which the given service instances
  88 depend.
  89 .It Fl D







  90 Lists the service instances that depend on the given services or service
  91 instances.
  92 .It Fl H
  93 Used for scripting mode.
  94 Do not print headers and separate fields by a single tab instead of arbitrary
  95 white space.
  96 .It Fl l
  97 Displays all available information about the selected services and service
  98 instances, with one service attribute displayed for each line.
  99 Information for different instances are separated by blank lines.
 100 .Pp












 101 The following specific attributes require further explanation:
 102 .Bl -tag -width "dependency"
 103 .It Sy dependency
 104 Information about a dependency.
 105 The grouping and
 106 .Ar restart_on
 107 properties are displayed first and are separated by a forward slash
 108 .Pq Sy / .
 109 Next, each entity and its state is listed.
 110 See
 111 .Xr smf 5
 112 for information about states.
 113 In addition to the standard states, each service dependency can have the
 114 following state descriptions:
 115 .Bl -tag -width "multiple"
 116 .It Sy absent




 117 No such service is defined on the system.
 118 .It Sy invalid
 119 The fault management resource identifier
 120 .Pq FMRI
 121 is invalid
 122 .Pq see Xr smf 5 .
 123 .It Sy multiple











 124 The entity is a service with multiple instances.
 125 .El
 126 .Pp
 127 File dependencies can only have one of the following state descriptions:
 128 .Bl -tag -width "unknown"
 129 .It Sy absent




 130 No such file on the system.
 131 .It Sy online







 132 The file exists.
 133 .Pp
 134 If the file did not exist the last time that
 135 .Nm svc.startd
 136 evaluated the service's dependencies, it can consider the dependency to be
 137 unsatisfied.
 138 .Nm svcadm Cm refresh
 139 forces dependency re-evaluation.
 140 .It Sy unknown
 141 .Xr stat 2
 142 failed for a reason other than
 143 .Dv ENOENT .
 144 .El
 145 .Pp
 146 See
 147 .Xr smf 5
 148 for additional details about dependencies, grouping, and
 149 .Ar restart_on
 150 values.
 151 .It Sy enabled






 152 Whether the service is enabled or not, and whether it is enabled or disabled
 153 temporarily
 154 .Pq until the next system reboot .
 155 The former is specified as either
 156 .Sy true
 157 or
 158 .Sy false ,
 159 and the latter is designated by the presence of
 160 .Pq Sy temporary .
 161 .Pp
 162 A service might be temporarily disabled because an administrator has run
 163 .Nm svcadm Cm disable Fl t ,
 164 used
 165 .Nm svcadm Cm milestone ,
 166 or booted the system to a specific milestone.
 167 See
 168 .Xr svcadm 1M
 169 for details.
 170 .El
 171 .It Fl L



 172 Display the log file of the selected services and service instances, one
 173 per-line.
 174 .It Fl o Ar col Ns Oo , Ns Ar col Oc Ns ...
 175 Prints the specified columns.
 176 Each
 177 .Ar col
 178 should be a column name.
 179 See
 180 .Sx COLUMNS
 181 below for available columns.
 182 .It Fl p
 183 Lists processes associated with each service instance.
 184 A service instance can have no associated processes.
 185 The process ID, start time, and command name
 186 .Po
 187 .Sy PID , STIME ,
 188 and
 189 .Sy CMD
 190 fields from
 191 .Xr ps 1
 192 .Pc
 193 are displayed for each process.
 194 .It Fl R Ar FMRI-instance









 195 Selects service instances that have the given service instance as their
 196 restarter.
 197 .It Fl s Ar col
 198 Sorts output by column.
 199 .Ar col
 200 should be a column name.
 201 See
 202 .Sx COLUMNS
 203 below for available columns.
 204 Multiple
 205 .Fl s
 206 options behave additively.
 207 .It Fl S Ar col
 208 Sorts by
 209 .Ar col
 210 in the opposite order as option
 211 .Fl s .
 212 .It Fl v
 213 Without
 214 .Fl x
 215 or
 216 .Fl l ,
 217 displays verbose columns:
 218 .Sy STATE , NSTATE , STIME , CTID ,
 219 and
 220 .Sy FMRI .
 221 .Pp
 222 With
 223 .Fl x ,
 224 displays extra information for each explanation.
 225 .Pp
 226 With
 227 .Fl l ,
 228 displays user-visible properties in property groups of type
 229 .Sy application
 230 and their description.
 231 .It Fl x







 232 Displays explanations for service states.
 233 .Pp
 234 Without arguments, the
 235 .Fl x
 236 option explains the states of services which:
 237 .Bl -bullet
 238 .It
 239 are enabled, but are not running.
 240 .It




 241 are preventing another enabled service from running.
 242 .El
 243 .It Fl z Ar zone
 244 Display only the services in the
 245 .Ar zone .
 246 This option is only applicable in the global zone, see
 247 .Xr zones 5 .
 248 .It Fl Z












 249 Display services from all zones, with an additional column indicating in which
 250 zone the service is running.
 251 This option is only applicable in the global zone, see
 252 .Xr zones 5 .
 253 .El
 254 .Sh OPERANDS


 255 The following operands are supported:
 256 .Bl -tag -width "FMRI-instance"
 257 .It Ar FMRI
 258 A fault management resource identifier
 259 .Pq FMRI
 260 that specifies one or more instances
 261 .Pq see Xr smf 5 .
 262 FMRIs can be abbreviated by specifying the instance name, or the trailing
 263 portion of the service name.
 264 For example, given the FMRI
 265 .Sy svc:/network/smtp:sendmail ,
 266 the following are valid abbreviations:
 267 .Sy sendmail :sendmail smtp smtp:sendmail network/smtp ,
 268 and the following are invalid abbreviations:
 269 .Sy mail network network/smt .
 270 .Pp



























 271 If the FMRI specifies a service, then the command applies to all instances of
 272 that service, except when used with the
 273 .Fl D
 274 option.
 275 .Pp
 276 Abbreviated forms of FMRIs are unstable, and should not be used in scripts or
 277 other permanent tools.
 278 .It Ar pattern
 279 A pattern that is matched against the FMRI of service instances according to the
 280 "globbing" rules described by
 281 .Xr fnmatch 5 .
 282 If the pattern does not begin with
 283 .Sy svc: ,
 284 then
 285 .Sy svc:/
 286 is prepended.
 287 The following is a typical example of a glob pattern:
 288 .Bd -literal




 289 qexample% svcs \e*keyserv\e*
 290 STATE          STIME     FMRI
 291 disabled       Aug_02    svc:/network/rpc/keyserv:default
 292 .Ed
 293 .It Ar FMRI-instance










 294 An FMRI that specifies an instance.
 295 .El
 296 .Sh COLUMNS
 297 Column names are case insensitive.
 298 The default output format is equivalent to
 299 .Fl o Sy state,stime,fmri .
 300 The default sorting columns are
 301 .Sy STATE , STIME , FMRI .
 302 .Bl -tag -width "NSTATE"
 303 .It Sy CTID
 304 The primary contract ID for the service instance.
 305 Not all instances have valid primary contract IDs.
 306 .It Sy DESC
 307 A brief description of the service, from its template element.
 308 A service might not have a description available, in which case a hyphen
 309 .Pq Sy \(hy
 310 is used to denote an empty value.
 311 .It Sy FMRI
 312 The FMRI of the service instance.
 313 .It Sy INST

























 314 The instance name of the service instance.
 315 .It Sy NSTA
 316 The abbreviated next state of the service instance, as given in the
 317 .Sy STA
 318 column description.
 319 A hyphen denotes that the instance is not transitioning.
 320 Same as
 321 .Sy STA
 322 otherwise.
 323 .It Sy NSTATE
 324 The next state of the service.
 325 A hyphen is used to denote that the instance is not transitioning.
 326 Same as
 327 .Sy STATE
 328 otherwise.
 329 .It Sy SCOPE














 330 The scope name of the service instance.
 331 .It Sy SVC







 332 The service name of the service instance.
 333 .It Sy STA
 334 The abbreviated state of the service instance:
 335 .Bl -tag -width "DGD"
 336 .It Sy DGD











 337 degraded
 338 .It Sy DIS







 339 disabled
 340 .It Sy LRC
 341 legacy rc*.d script-initiated instance
 342 .It Sy MNT














 343 maintenance
 344 .It Sy OFF







 345 offline
 346 .It Sy ON







 347 online
 348 .It Sy UN







 349 uninitialized
 350 .El
 351 .Pp
 352 Absent or unrecognized states are denoted by a question mark
 353 .Pq Sy \?
 354 character.
 355 An asterisk
 356 .Pq Sy *
 357 is appended for instances in transition, unless the
 358 .Sy NSTA
 359 or
 360 .Sy NSTATE
 361 column is also being displayed.
 362 .It Sy STATE
 363 The state of the service instance.
 364 An asterisk is appended for instances in transition, unless the
 365 .Sy NSTA
 366 or
 367 .Sy NSTATE
 368 column is also being displayed.
 369 .It Sy STIME








 370 If the service instance entered the current state within the last 24 hours,
 371 this column indicates the time that it did so.
 372 Otherwise, this column indicates the date on which it did so, printed with
 373 underscores
 374 .Pq Sy _
 375 in place of blanks.
 376 .El
 377 .Sh EXIT STATUS
 378 The following exit values are returned:
 379 .Bl -tag -width "0"
 380 .It Sy 0
 381 Successful command invocation.
 382 .It Sy 1
 383 Fatal error.
 384 .It Sy 2
 385 Invalid command line options were specified.
 386 .El
 387 .Sh EXAMPLES
 388 .Bl -tag -width ""
 389 .It Sy Example 1 No Displaying the Default Output
 390 This example displays default output:
 391 .Bd -literal



 392 example% svcs
 393 STATE          STIME    FMRI
 394 \&...
 395 legacy_run     13:25:04 lrc:/etc/rc3_d/S42myscript
 396 \&...
 397 online         13:21:50 svc:/system/svc/restarter:default
 398 \&...
 399 online         13:25:03 svc:/milestone/multi-user:default
 400 \&...
 401 online         13:25:07 svc:/milestone/multi-user-server:default
 402 \&...
 403 .Ed
 404 .It Sy Example 2 No Listing All Local Instances
 405 This example lists all local instances of the
 406 .Sy service1
 407 service:
 408 .Bd -literal







 409 example% svcs -o state,nstate,fmri service1
 410 STATE        NSTATE        FMRI
 411 online       -             svc:/service1:instance1
 412 disabled     -             svc:/service1:instance2
 413 .Ed
 414 .It Sy Example 3 No Listing Verbose Information
 415 This example lists verbose information:
 416 .Bd -literal









 417 example% svcs -v network/rpc/rstat:udp
 418 STATE          NSTATE        STIME    CTID   FMRI
 419 online         -             Aug_09        - svc:/network/rpc/rstat:udp
 420 .Ed
 421 .It Sy Example 4 No Listing Detailed Information






 422 This example lists detailed information about all instances of
 423 .Sy system/service3 .
 424 Additional fields can be displayed, as appropriate to the managing restarter.
 425 .Bd -literal



 426 example% svcs -l network/rpc/rstat:udp
 427 
 428 fmri         svc:/network/rpc/rstat:udp
 429 enabled      true
 430 state        online
 431 next_state   none
 432 restarter    svc:/network/inetd:default
 433 contract_id
 434 dependency   require_all/error svc:/network/rpc/bind (online)
 435 .Ed
 436 .It Sy Example 5 No Listing Processes
 437 .Bd -literal






 438 example% svcs -p sendmail
 439 STATE          STIME    FMRI
 440 online         13:25:13 svc:/network/smtp:sendmail
 441                13:25:15   100939 sendmail
 442                13:25:15   100940 sendmail
 443 .Ed
 444 .It Sy Example 6 No Explaining Service States Using Nm Fl x
 445 .Bl -enum
 446 .It
 447 In this example,
 448 .Nm
 449 .Fl x
 450 has identified that the
 451 .Sy print/server
 452 service being disabled is the root cause of two services which are enabled but
 453 not online.
 454 .Nm Fl xv
 455 shows that those services are
 456 .Sy print/rfc1179
 457 and
 458 .Sy print/ipp-listener .
 459 This situation can be rectified by either enabling
 460 .Sy print/server
 461 or disabling
 462 .Sy rfc1179
 463 and
 464 .Sy ipp-listener .
 465 .Bd -literal
 466 example% svcs -x
 467 svc:/application/print/server:default (LP print server)
 468  State: disabled since Mon Feb 13 17:56:21 2006
 469 Reason: Disabled by an administrator.
 470    See: http://illumos.org/msg/SMF-8000-05
 471    See: lpsched(1M)
 472 Impact: 2 dependent services are not running. (Use -v for list.)
 473 .Ed
 474 .It
 475 In this example, NFS is not working:
 476 .Bd -literal







 477 example$ svcs nfs/client
 478 STATE          STIME    FMRI
 479 offline        16:03:23 svc:/network/nfs/client:default
 480 .Ed
 481 .It
 482 The following example shows that the problem is
 483 .Sy nfs/status .
 484 .Sy nfs/client
 485 is waiting because it depends on
 486 .Sy nfs/nlockmgr ,
 487 which depends on
 488 .Sy nfs/status :
 489 .Bd -literal



 490 example$ svcs -xv nfs/client
 491 svc:/network/nfs/client:default (NFS client)
 492  State: offline since Mon Feb 27 16:03:23 2006
 493 Reason: Service svc:/network/nfs/status:default
 494         is not running because a method failed repeatedly.
 495    See: http://illumos.org/msg/SMF-8000-GE
 496   Path: svc:/network/nfs/client:default
 497           svc:/network/nfs/nlockmgr:default
 498             svc:/network/nfs/status:default
 499    See: man -M /usr/share/man -s 1M mount_nfs
 500    See: /var/svc/log/network-nfs-client:default.log
 501 Impact: This service is not running.
 502 .Ed
 503 .El
 504 .El
 505 .Sh INTERFACE STABILITY
 506 Screen output is
 507 .Sy Uncommitted .
 508 The invocation is
 509 .Sy Committed .
 510 .Sh SEE ALSO
 511 .Xr ps 1 ,
 512 .Xr svcprop 1 ,
 513 .Xr svc.startd 1M ,
 514 .Xr svcadm 1M ,
 515 .Xr svccfg 1M ,
 516 .Xr stat 2 ,
 517 .Xr libscf 3LIB ,
 518 .Xr attributes 5 ,
 519 .Xr fnmatch 5 ,
 520 .Xr smf 5 ,
 521 .Xr zones 5