946 want ability to list services in a zone from the GZ
[illumos-gate.git] / usr / src / man / man1 / svcs.1
blobc7c41a863cbb19d5cf006f906ca55108fa75e282
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 "17 Apr 2011" "SunOS 5.11" "User Commands"
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
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
22 .LP
23 .nf
24 \fBsvcs\fR \fB-l\fR [\fB-vZ\fR] [\fB-z\fR \fIzone\fR] [\fIFMRI\fR | \fIpattern\fR]...
25 .fi
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
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 .mk
71 .na
72 \fB\fB-?\fR\fR
73 .ad
74 .RS 20n
75 .rt  
76 Displays an extended usage message, including column specifiers.
77 .RE
79 .sp
80 .ne 2
81 .mk
82 .na
83 \fB\fB-a\fR\fR
84 .ad
85 .RS 20n
86 .rt  
87 Show all services, even disabled ones. This option has no effect if services
88 are selected.
89 .RE
91 .sp
92 .ne 2
93 .mk
94 .na
95 \fB\fB-d\fR\fR
96 .ad
97 .RS 20n
98 .rt  
99 Lists the services or service instances upon which the given service instances
100 depend.
104 .ne 2
107 \fB\fB-D\fR\fR
109 .RS 20n
110 .rt  
111 Lists the service instances that depend on the given services or service
112 instances.
116 .ne 2
119 \fB\fB-H\fR\fR
121 .RS 20n
122 .rt  
123 Omits the column headers.
127 .ne 2
130 \fB\fB-l\fR\fR
132 .RS 20n
133 .rt  
134 (The letter ell.) Displays all available information about the selected
135 services and service instances, with one service attribute displayed for each
136 line. Information for different instances are separated by blank lines.
138 The following specific attributes require further explanation:
140 .ne 2
143 \fB\fBdependency\fR\fR
145 .RS 14n
146 .rt  
147 Information about a dependency. The grouping and \fBrestart_on\fR properties
148 are displayed first and are separated by a forward slash (\fB/\fR). Next, each
149 entity and its state is listed. See \fBsmf\fR(5) for information about states.
150 In addition to the standard states, each service dependency can have the
151 following state descriptions:
153 .ne 2
156 \fB\fBabsent\fR\fR
158 .RS 12n
159 .rt  
160 No such service is defined on the system.
164 .ne 2
167 \fB\fBinvalid\fR\fR
169 .RS 12n
170 .rt  
171 The fault management resource identifier (FMRI) is invalid (see \fBsmf\fR(5)).
175 .ne 2
178 \fB\fBmultiple\fR\fR
180 .RS 12n
181 .rt  
182 The entity is a service with multiple instances.
185 File dependencies can only have one of the following state descriptions:
187 .ne 2
190 \fB\fBabsent\fR\fR
192 .RS 11n
193 .rt  
194 No such file on the system.
198 .ne 2
201 \fB\fBonline\fR\fR
203 .RS 11n
204 .rt  
205 The file exists.
207 If the file did not exist the last time that \fBsvc.startd\fR evaluated the
208 service's dependencies, it can consider the dependency to be unsatisfied.
209 \fBsvcadm refresh\fR forces dependency re-evaluation.
213 .ne 2
216 \fB\fBunknown\fR\fR
218 .RS 11n
219 .rt  
220 \fBstat\fR(2) failed for a reason other than \fBENOENT\fR.
223 See \fBsmf\fR(5) for additional details about dependencies, grouping, and
224 \fBrestart_on\fR values.
228 .ne 2
231 \fB\fBenabled\fR\fR
233 .RS 14n
234 .rt  
235 Whether the service is enabled or not, and whether it is enabled or disabled
236 temporarily (until the next system reboot). The former is specified as either
237 \fBtrue\fR or \fBfalse\fR, and the latter is designated by the presence of
238 \fB(temporary)\fR.
240 A service might be temporarily disabled because an administrator has run
241 \fBsvcadm disable -t\fR, used \fBsvcadm milestone\fR, or booted the system to a
242 specific milestone. See \fBsvcadm\fR(1M) for details.
248 .ne 2
251 \fB\fB-o\fR \fIcol\fR[,\fIcol\fR]...\fR
253 .RS 20n
254 .rt  
255 Prints the specified columns. Each \fIcol\fR should be a column name. See
256 \fBCOLUMNS\fR below for available columns.
260 .ne 2
263 \fB\fB-p\fR\fR
265 .RS 20n
266 .rt  
267 Lists processes associated with each service instance. A service instance can
268 have no associated processes. The process ID, start time, and command name
269 (\fBPID\fR, \fBSTIME\fR, and \fBCMD\fR fields from \fBps\fR(1)) are displayed
270 for each process.
274 .ne 2
277 \fB\fB-R\fR \fIFMRI-instance\fR\fR
279 .RS 20n
280 .rt  
281 Selects service instances that have the given service instance as their
282 restarter.
286 .ne 2
289 \fB\fB-s\fR \fIcol\fR\fR
291 .RS 20n
292 .rt  
293 Sorts output by column. \fIcol\fR should be a column name. See \fBCOLUMNS\fR
294 below for available columns. Multiple \fB-s\fR options behave additively.
298 .ne 2
301 \fB\fB-S\fR \fIcol\fR\fR
303 .RS 20n
304 .rt  
305 Sorts by \fIcol\fR in the opposite order as option \fB-s\fR.
309 .ne 2
312 \fB\fB-v\fR\fR
314 .RS 20n
315 .rt  
316 Without \fB-x\fR or \fB-l\fR, displays verbose columns: \fBSTATE\fR,
317 \fBNSTATE\fR, \fBSTIME\fR, \fBCTID\fR, and \fBFMRI\fR.
319 With \fB-x\fR, displays extra information for each explanation.
321 With \fB-l\fR, displays user-visible properties in property groups of type
322 \fBapplication\fR and their description.
326 .ne 2
329 \fB\fB-x\fR\fR
331 .RS 20n
332 .rt  
333 Displays explanations for service states.
335 Without arguments, the \fB-x\fR option explains the states of services which:
336 .RS +4
338 .ie t \(bu
339 .el o
340 are enabled, but are not running.
342 .RS +4
344 .ie t \(bu
345 .el o
346 are preventing another enabled service from running.
351 .ne 2
354 \fB-z \fIzone\fR
356 .RS 20n
358 Display only the services in the \fIzone\fR.  This option is only applicable
359 in the global zone, see \fBzones\fR(5).
363 .ne 2
366 \fB-Z\fR
368 .RS 20n
370 Display services from all zones, with an additional column indicating in which
371 zone the service is running.  This option is only applicable in the global
372 zone, see \fBzones\fR(5).
375 .SH OPERANDS
378 The following operands are supported:
380 .ne 2
383 \fB\fIFMRI\fR\fR
385 .RS 17n
386 .rt  
387 A fault management resource identifier (FMRI) that specifies one or more
388 instances (see \fBsmf\fR(5)). FMRIs can be abbreviated by specifying the
389 instance name, or the trailing portion of the service name. For example, given
390 the FMRI:
392 .in +2
394 svc:/network/smtp:sendmail
396 .in -2
399 The following are valid abbreviations:
401 .in +2
403 sendmail
404 :sendmail
405 smtp
406 smtp:sendmail
407 network/smtp
409 .in -2
412 The following are invalid abbreviations:
414 .in +2
416 mail
417 network
418 network/smt
420 .in -2
423 If the FMRI specifies a service, then the command applies to all instances of
424 that service, except when used with the \fB-D\fR option.
426 Abbreviated forms of FMRIs are unstable, and should not be used in scripts or
427 other permanent tools.
431 .ne 2
434 \fB\fIpattern\fR\fR
436 .RS 17n
437 .rt  
438 A pattern that is matched against the \fIFMRI\fRs of service instances
439 according to the "globbing" rules described by \fBfnmatch\fR(5). If the pattern
440 does not begin with \fBsvc:\fR, then \fBsvc:/\fR is prepended. The following is
441 a typical example of a glob pattern:
443 .in +2
445 qexample% svcs \e*keyserv\e*
446 STATE          STIME     FMRI
447 disabled       Aug_02    svc:/network/rpc/keyserv:default
449 .in -2
455 .ne 2
458 \fB\fIFMRI-instance\fR\fR
460 .RS 17n
461 .rt  
462 An FMRI that specifies an instance.
465 .SH COLUMNS
468 Column names are case insensitive. The default output format is equivalent to
469 "\fB-o\fR \fBstate,stime,fmri\fR". The default sorting columns are \fBSTATE\fR,
470 \fBSTIME\fR, \fBFMRI\fR.
472 .ne 2
475 \fB\fBCTID\fR\fR
477 .RS 10n
478 .rt  
479 The primary contract ID for the service instance. Not all instances have valid
480 primary contract IDs.
484 .ne 2
487 \fB\fBDESC\fR\fR
489 .RS 10n
490 .rt  
491 A brief description of the service, from its template element. A service might
492 not have a description available, in which case a hyphen (\fB\(hy\fR) is used
493 to denote an empty value.
497 .ne 2
500 \fB\fBFMRI\fR\fR
502 .RS 10n
503 .rt  
504 The \fIFMRI\fR of the service instance.
508 .ne 2
511 \fB\fBINST\fR\fR
513 .RS 10n
514 .rt  
515 The instance name of the service instance.
519 .ne 2
522 \fB\fBNSTA\fR\fR
524 .RS 10n
525 .rt  
526 The abbreviated next state of the service instance, as given in the \fBSTA\fR
527 column description. A hyphen denotes that the instance is not transitioning.
528 Same as \fBSTA\fR otherwise.
532 .ne 2
535 \fB\fBNSTATE\fR\fR
537 .RS 10n
538 .rt  
539 The next state of the service. A hyphen is used to denote that the instance is
540 not transitioning. Same as \fBSTATE\fR otherwise.
544 .ne 2
547 \fB\fBSCOPE\fR\fR
549 .RS 10n
550 .rt  
551 The scope name of the service instance.
555 .ne 2
558 \fB\fBSVC\fR\fR
560 .RS 10n
561 .rt  
562 The service name of the service instance.
566 .ne 2
569 \fB\fBSTA\fR\fR
571 .RS 10n
572 .rt  
573 The abbreviated state of the service instance (see \fBsmf\fR(5)):
575 .ne 2
578 \fB\fBDGD\fR\fR
580 .RS 7n
581 .rt  
582 degraded
586 .ne 2
589 \fB\fBDIS\fR\fR
591 .RS 7n
592 .rt  
593 disabled
597 .ne 2
600 \fB\fBLRC\fR\fR
602 .RS 7n
603 .rt  
604 legacy \fBrc*.d\fR script-initiated instance
608 .ne 2
611 \fB\fBMNT\fR\fR
613 .RS 7n
614 .rt  
615 maintenance
619 .ne 2
622 \fB\fBOFF\fR\fR
624 .RS 7n
625 .rt  
626 offline
630 .ne 2
633 \fB\fBON\fR\fR
635 .RS 7n
636 .rt  
637 online
641 .ne 2
644 \fB\fBUN\fR\fR
646 .RS 7n
647 .rt  
648 uninitialized
651 Absent or unrecognized states are denoted by a question mark (\fB?\fR)
652 character. An asterisk (\fB*\fR) is appended for instances in transition,
653 unless the \fBNSTA\fR or \fBNSTATE\fR column is also being displayed.
655 See \fBsmf\fR(5) for an explanation of service states.
659 .ne 2
662 \fB\fBSTATE\fR\fR
664 .RS 10n
665 .rt  
666 The state of the service instance. An asterisk is appended for instances in
667 transition, unless the \fBNSTA\fR or \fBNSTATE\fR column is also being
668 displayed.
670 See \fBsmf\fR(5) for an explanation of service states.
674 .ne 2
677 \fB\fBSTIME\fR\fR
679 .RS 10n
680 .rt  
681 If the service instance entered the current state within the last 24 hours,
682 this column indicates the time that it did so. Otherwise, this column indicates
683 the date on which it did so, printed with underscores (\fB_\fR) in place of
684 blanks.
687 .SH EXAMPLES
689 \fBExample 1 \fRDisplaying the Default Output
692 This example displays default output:
695 .in +2
697 example% svcs
698 STATE          STIME    FMRI
699 \&...
700 legacy_run     13:25:04 lrc:/etc/rc3_d/S42myscript
701 \&...
702 online         13:21:50 svc:/system/svc/restarter:default
703 \&...
704 online         13:25:03 svc:/milestone/multi-user:default
705 \&...
706 online         13:25:07 svc:/milestone/multi-user-server:default
707 \&...
709 .in -2
713 \fBExample 2 \fRListing All Local Instances
716 This example lists all local instances of the \fBservice1\fR service.
719 .in +2
721 example% svcs -o state,nstate,fmri service1
722 STATE        NSTATE        FMRI
723 online       -             svc:/service1:instance1
724 disabled     -             svc:/service1:instance2
726 .in -2
730 \fBExample 3 \fRListing Verbose Information
733 This example lists verbose information.
736 .in +2
738 example% svcs -v network/rpc/rstat:udp
739 STATE          NSTATE        STIME    CTID   FMRI
740 online         -             Aug_09        - svc:/network/rpc/rstat:udp
742 .in -2
746 \fBExample 4 \fRListing Detailed Information
749 This example lists detailed information about all instances of
750 \fBsystem/service3\fR. Additional fields can be displayed, as appropriate to
751 the managing restarter.
754 .in +2
756 example% svcs -l network/rpc/rstat:udp
758 fmri         svc:/network/rpc/rstat:udp
759 enabled      true
760 state        online
761 next_state   none
762 restarter    svc:/network/inetd:default
763 contract_id
764 dependency   require_all/error svc:/network/rpc/bind (online)
766 .in -2
770 \fBExample 5 \fRListing Processes
772 .in +2
774 example% svcs -p sendmail
775 STATE          STIME    FMRI
776 online         13:25:13 svc:/network/smtp:sendmail
777                13:25:15   100939 sendmail
778 13:25:15   100940 sendmail  
780 .in -2
784 \fBExample 6 \fRExplaining Service States Using \fBsvcs\fR \fB-x\fR
787 (a) In this example, \fBsvcs\fR \fB-x\fR has identified that the print/server
788 service being disabled is the root cause of two services which are enabled but
789 not online. \fBsvcs\fR \fB-xv\fR shows that those services are
790 \fBprint/rfc1179\fR and \fBprint/ipp-listener\fR. This situation can be
791 rectified by either enabling \fBprint/server\fR or disabling \fBrfc1179\fR and
792 \fBipp-listener\fR.
795 .in +2
797 example% svcs -x
798 svc:/application/print/server:default (LP print server)
799  State: disabled since Mon Feb 13 17:56:21 2006
800 Reason: Disabled by an administrator.
801    See: http://sun.com/msg/SMF-8000-05
802    See: lpsched(1M)
803 Impact: 2 dependent services are not running. (Use -v for list.)
805 .in -2
810 (b) In this example, NFS is not working:
813 .in +2
815 example$ svcs nfs/client
816 STATE          STIME    FMRI
817 offline        16:03:23 svc:/network/nfs/client:default
819 .in -2
824 (c) The following example shows that the problem is \fBnfs/status\fR.
825 \fBnfs/client\fR is waiting because it depends on \fBnfs/nlockmgr\fR, which
826 depends on \fBnfs/status\fR:
829 .in +2
831 example$ svcs -xv nfs/client
832 svc:/network/nfs/client:default (NFS client)
833  State: offline since Mon Feb 27 16:03:23 2006
834 Reason: Service svc:/network/nfs/status:default
835         is not running because a method failed repeatedly.
836    See: http://sun.com/msg/SMF-8000-GE
837   Path: svc:/network/nfs/client:default
838           svc:/network/nfs/nlockmgr:default
839             svc:/network/nfs/status:default
840    See: man -M /usr/share/man -s 1M mount_nfs
841    See: /var/svc/log/network-nfs-client:default.log
842 Impact: This service is not running.
844 .in -2
847 .SH EXIT STATUS
850 The following exit values are returned:
852 .ne 2
855 \fB\fB0\fR\fR
857 .RS 5n
858 .rt  
859 Successful command invocation.
863 .ne 2
866 \fB\fB1\fR\fR
868 .RS 5n
869 .rt  
870 Fatal error.
874 .ne 2
877 \fB\fB2\fR\fR
879 .RS 5n
880 .rt  
881 Invalid command line options were specified.
884 .SH ATTRIBUTES
887 See \fBattributes\fR(5) for descriptions of the following attributes:
892 tab(\a) box;
893 cw(2.75i) |cw(2.75i) 
894 lw(2.75i) |lw(2.75i) 
896 ATTRIBUTE TYPE\aATTRIBUTE VALUE
898 Interface Stability\aSee below.
903 Screen output is Uncommitted. The invocation is Committed.
904 .SH SEE ALSO
907 \fBps\fR(1), \fBsvcprop\fR(1), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M),
908 \fBsvc.startd\fR(1M), \fBstat\fR(2), \fBlibscf\fR(3LIB), \fBattributes\fR(5),
909 \fBfnmatch\fR(5), \fBsmf\fR(5), \fBzones\fR(5)