2 .\" Copyright (c) 2007, 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 SVCPROP 1 "April 9, 2016"
8 svcprop \- retrieve values of service configuration properties
12 \fBsvcprop\fR [\fB-fqtv\fR] [\fB-C\fR | \fB-c\fR | \fB-s\fR \fIsnapshot\fR]
13 [\fB-z\fR \fIzone\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR]...
14 {\fIFMRI\fR | \fIpattern\fR}...
19 \fBsvcprop\fR \fB-w\fR [\fB-fqtv\fR] [\fB-z\fR \fIzone\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR] {\fIFMRI\fR | \fIpattern\fR}
24 The \fBsvcprop\fR utility prints values of properties in the service
25 configuration repository. Properties are selected by \fB-p\fR options and the
29 Without the \fB-C\fR, \fB-c\fR, or \fB-s\fR options, \fBsvcprop\fR accesses
30 effective properties. The effective properties of a service are its directly
31 attached properties. The effective properties of a service instance are the
32 union of properties in the composed view of its \fBrunning\fR snapshot and the
33 properties in nonpersistent property groups in the composed view of the
34 instance's directly attached properties. See \fBsmf\fR(5) for an explanation of
35 property composition. If the \fBrunning\fR snapshot does not exist then the
36 instance's directly attached properties are used instead.
39 By default, when a single property is selected, the values for each are printed
40 on separate lines. Empty \fBASCII\fR string values are represented by a pair of
41 double quotes (\fB""\fR). Bourne shell metacharacters ('\fB;\fR', '\fB&\fR\&',
42 \&'\fB(\fR', '\fB)\fR', '\fB|\fR', '\fB^\fR', '\fB<\fR\&', '\fB>\fR', newline,
43 space, tab, backslash, '\fB"\fR', single-quote, '\fB`\fR') in \fBASCII\fR
44 string values are quoted by backslashes (\fB\e\fR).
47 When multiple properties are selected, a single line is printed for each. Each
48 line comprises a property designator, a property type, and the values (as
49 described above), separated by spaces. By default, if a single \fIFMRI\fR
50 operand has been supplied, the property designator consists of the property
51 group name and the property name joined by a slash (\fB/\fR). If multiple
52 \fIFMRI\fR operands are supplied, the designator is the canonical \fIFMRI\fR
56 If access controls prohibit reading the value of a property, and no property or
57 property group is specified explicitly by a \fB-p\fR option, the property is
58 displayed as if it had no values. If one or more property or property group
59 names is specified by a \fB-p\fR option, and any property value cannot be read
60 due to access controls, an error results.
63 Error messages are printed to the standard error stream.
66 The following options are supported:
73 Uses the directly attached properties, without composition.
82 For service instances, uses the composed view of their directly attached
92 Selects the multi-property output format, with full FMRIs as designators.
98 \fB\fB-p\fR \fIname\fR\fR
101 For each service or service instance specified by the operands, selects all
102 properties in the \fIname\fR property group. For property groups specified by
103 the operands, selects the \fIname\fR property.
109 \fB\fB-p\fR \fIpg\fR/\fIprop\fR\fR
112 Selects property \fIprop\fR in property group \fIpg\fR for each of the services
113 or service instances specified by the operands.
122 Quiet. Produces no output.
128 \fB\fB-s\fR \fIname\fR\fR
131 Uses the composed view of the \fIname\fR snapshot for service instances.
140 Selects the multi-property output format.
149 Verbose. Prints error messages for nonexistent properties, even if option -q is
159 Waits until the specified property group or the property group containing the
160 specified property changes before printing.
162 This option is only valid when a single entity is specified. If more than one
163 operand is specified, or an operand matches more than one instance, an error
164 message is printed and no action is taken. The -C option is implied.
173 Uses properties from the service or instance in the specified \fIzone\fR.
174 This option is only applicable from the global zone, see \fBzones\fR(5).
178 The following operands are supported:
185 The FMRI of a service, a service instance, a property group, or a property.
187 Instances and services can be abbreviated by specifying the instance name, or
188 the trailing portion of the service name. Properties and property groups must
189 be specified by a full FMRI. For example, given the FMRI:
193 svc:/network/smtp:sendmail
198 The following are valid abbreviations:
211 The following are invalid abbreviations:
222 Abbreviated forms of FMRIs are unstable and should not be used in scripts or
223 other permanent tools. If an abbreviation matches multiple instances,
224 \fBsvcprop\fR acts on each instance.
233 A glob pattern which is matched against the FMRIs of services and instances in
234 the repository. See \fBfnmatch\fR(5). If a pattern matches multiple services or
235 instances, \fBsvcprop\fR acts on each service or instance.
240 \fBExample 1 \fRDisplaying the Value of a Single Property
243 The following example displays the value of the state property in the restarter
244 property group of instance \fBdefault\fR of service \fBsystem/cron\fR.
249 example% svcprop -p restarter/state system/cron:default
256 \fBExample 2 \fRRetrieving Whether a Service is Enabled
259 Whether a service is enabled is determined by its \fB-general/enabled\fR
260 property. This property takes immediate effect, so the \fB-c\fR option must be
266 example% svcprop -c -p general/enabled system/cron:default
273 \fBExample 3 \fRDisplaying All Properties in a Property Group
276 On a default installation of Solaris, the following example displays all
277 properties in the \fBgeneral\fR property group of each instance of the
278 \fBnetwork/ntp\fR service:
283 example% svcprop -p general ntp
284 general/package astring SUNWntpr
285 general/enabled boolean true
286 general/entity_stability astring Unstable
287 general/single_instance boolean true
293 \fBExample 4 \fRTesting the Existence of a Property
296 The following example tests the existence of the \fBgeneral/enabled\fR property
297 for all instances of service identity:
302 example% svcprop -q -p general/enabled identity:
310 \fBExample 5 \fRWaiting for Property Change
313 The following example waits for the \fBsendmail\fR instance to change state.
318 example% svcprop -w -p restarter/state sendmail
324 \fBExample 6 \fRRetrieving the Value of a Boolean Property in a Script
327 The following example retrieves the value of a boolean property in a script:
332 set -- `svcprop -c -t -p general/enabled service`
334 if [ $code -ne 0 ]; then
335 echo "svcprop failed with exit code $code"
338 if [ $2 != boolean ]; then
339 echo "general/enabled has unexpected type $2"
342 if [ $# -ne 3 ]; then
343 echo "general/enabled has wrong number of values"
353 \fBExample 7 \fRUsing \fBsvcprop\fR in a Script
362 if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
371 The following exit values are returned:
378 Successful completion.
396 Invalid command line options were specified.
401 \fBsvcs\fR(1), \fBinetd\fR(8), \fBsvcadm\fR(8), \fBsvccfg\fR(8),
402 \fBsvc.startd\fR(8), \fBservice_bundle\fR(4), \fBattributes\fR(5),
403 \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5),