1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright 2019 Joyent, Inc.
.\" 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.
.\" 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.
.\" 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]
.TH SVCPROP 1 "Dec 11, 2019"
.SH NAME
svcprop \- retrieve values of service configuration properties
.SH SYNOPSIS
.nf
\fBsvcprop\fR [\fB-fqtv\fR] [\fB-C\fR | \fB-c\fR | \fB-s\fR \fIsnapshot\fR]
[\fB-z\fR \fIzone\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR]...
{\fIFMRI\fR | \fIpattern\fR}...
.fi
.LP
.nf
\fBsvcprop\fR \fB-w\fR [\fB-fqtv\fR] [\fB-z\fR \fIzone\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR] {\fIFMRI\fR | \fIpattern\fR}
.fi
.SH DESCRIPTION
The \fBsvcprop\fR utility prints values of properties in the service
configuration repository. Properties are selected by \fB-p\fR options and the
operands.
.sp
.LP
Without the \fB-C\fR, \fB-c\fR, or \fB-s\fR options, \fBsvcprop\fR accesses
effective properties. The effective properties of a service are its directly
attached properties. The effective properties of a service instance are the
union of properties in the composed view of its \fBrunning\fR snapshot and the
properties in nonpersistent property groups in the composed view of the
instance's directly attached properties. See \fBsmf\fR(7) for an explanation of
property composition. If the \fBrunning\fR snapshot does not exist then the
instance's directly attached properties are used instead.
.SS "Output Format"
By default, when a single property is selected, the values for each are printed
on separate lines. Empty \fBASCII\fR string values are represented by a pair of
double quotes (\fB""\fR). Bourne shell metacharacters ('\fB;\fR', '\fB&\fR\&',
\&'\fB(\fR', '\fB)\fR', '\fB|\fR', '\fB^\fR', '\fB<\fR\&', '\fB>\fR', newline,
space, tab, backslash, '\fB"\fR', single-quote, '\fB`\fR') in \fBASCII\fR
string values are quoted by backslashes (\fB\e\fR).
.sp
.LP
When multiple properties are selected, a single line is printed for each. Each
line comprises a property designator, a property type, and the values (as
described above), separated by spaces. By default, if a single \fIFMRI\fR
operand has been supplied, the property designator consists of the property
group name and the property name joined by a slash (\fB/\fR). If multiple
\fIFMRI\fR operands are supplied, the designator is the canonical \fIFMRI\fR
for the property.
.sp
.LP
If access controls prohibit reading the value of a property, and no property or
property group is specified explicitly by a \fB-p\fR option, the property is
displayed as if it had no values. If one or more property or property group
names is specified by a \fB-p\fR option, and any property value cannot be read
due to access controls, an error results.
.sp
.LP
Error messages are printed to the standard error stream.
.SH OPTIONS
The following options are supported:
.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 14n
Uses the directly attached properties, without composition.
.RE
.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 14n
For service instances, uses the composed view of their directly attached
properties.
.RE
.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 14n
Selects the multi-property output format, with full FMRIs as designators.
.RE
.sp
.ne 2
.na
\fB\fB-p\fR \fIname\fR\fR
.ad
.RS 14n
For each service or service instance specified by the operands, selects all
properties in the \fIname\fR property group. For property groups specified by
the operands, selects the \fIname\fR property.
.RE
.sp
.ne 2
.na
\fB\fB-p\fR \fIpg\fR/\fIprop\fR\fR
.ad
.RS 14n
Selects property \fIprop\fR in property group \fIpg\fR for each of the services
or service instances specified by the operands.
.RE
.sp
.ne 2
.na
\fB\fB-q\fR\fR
.ad
.RS 14n
Quiet. Produces no output.
.RE
.sp
.ne 2
.na
\fB\fB-s\fR \fIname\fR\fR
.ad
.RS 14n
Uses the composed view of the \fIname\fR snapshot for service instances.
.RE
.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 14n
Selects the multi-property output format.
.RE
.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 14n
Verbose. Prints error messages for nonexistent properties, even if option -q is
also used.
.RE
.sp
.ne 2
.na
\fB\fB-w\fR\fR
.ad
.RS 14n
Waits until the specified property group or the property group containing the
specified property changes before printing.
.sp
This option is only valid when a single entity is specified. If more than one
operand is specified, or an operand matches more than one instance, an error
message is printed and no action is taken. The -C option is implied.
.RE
.sp
.ne 2
.na
\fB-z\fR \fIzone\fR
.ad
.RS 14n
Uses properties from the service or instance in the specified \fIzone\fR.
This option is only applicable from the global zone, see \fBzones\fR(7).
.SH OPERANDS
The following operands are supported:
.sp
.ne 2
.na
\fB\fIFMRI\fR\fR
.ad
.RS 11n
The FMRI of a service, a service instance, a property group, or a property.
.sp
Instances and services can be abbreviated by specifying the instance name, or
the trailing portion of the service name. Properties and property groups must
be specified by a full FMRI. For example, given the FMRI:
.sp
.in +2
.nf
svc:/network/smtp:sendmail
.fi
.in -2
.sp
The following are valid abbreviations:
.sp
.in +2
.nf
sendmail
:sendmail
smtp
smtp:sendmail
network/smtp
.fi
.in -2
.sp
The following are invalid abbreviations:
.sp
.in +2
.nf
mail
network
network/smt
.fi
.in -2
.sp
Abbreviated forms of FMRIs are unstable and should not be used in scripts or
other permanent tools. If an abbreviation matches multiple instances,
\fBsvcprop\fR acts on each instance.
.RE
.sp
.ne 2
.na
\fBpattern\fR
.ad
.RS 11n
A glob pattern which is matched against the FMRIs of services and instances in
the repository. See \fBfnmatch\fR(7). If a pattern matches multiple services or
instances, \fBsvcprop\fR acts on each service or instance.
.RE
.SH EXAMPLES
\fBExample 1 \fRDisplaying the Value of a Single Property
.sp
.LP
The following example displays the value of the state property in the restarter
property group of instance \fBdefault\fR of service \fBsystem/cron\fR.
.sp
.in +2
.nf
example% svcprop -p restarter/state system/cron:default
online
.fi
.in -2
.sp
.LP
\fBExample 2 \fRRetrieving Whether a Service is Enabled
.sp
.LP
Whether a service is enabled is determined by its \fB-general/enabled\fR
property. This property takes immediate effect, so the \fB-c\fR option must be
used:
.sp
.in +2
.nf
example% svcprop -c -p general/enabled system/cron:default
true
.fi
.in -2
.sp
.LP
\fBExample 3 \fRDisplaying All Properties in a Property Group
.sp
.LP
On a default installation of Solaris, the following example displays all
properties in the \fBgeneral\fR property group of each instance of the
\fBnetwork/ntp\fR service:
.sp
.in +2
.nf
example% svcprop -p general ntp
general/package astring SUNWntpr
general/enabled boolean true
general/entity_stability astring Unstable
.fi
.in -2
.sp
.LP
\fBExample 4 \fRTesting the Existence of a Property
.sp
.LP
The following example tests the existence of the \fBgeneral/enabled\fR property
for all instances of service identity:
.sp
.in +2
.nf
example% svcprop -q -p general/enabled identity:
example% echo $?
0
.fi
.in -2
.sp
.LP
\fBExample 5 \fRWaiting for Property Change
.sp
.LP
The following example waits for the \fBsendmail\fR instance to change state.
.sp
.in +2
.nf
example% svcprop -w -p restarter/state sendmail
.fi
.in -2
.sp
.LP
\fBExample 6 \fRRetrieving the Value of a Boolean Property in a Script
.sp
.LP
The following example retrieves the value of a boolean property in a script:
.sp
.in +2
.nf
set -- `svcprop -c -t -p general/enabled service`
code=$?
if [ $code -ne 0 ]; then
echo "svcprop failed with exit code $code"
return 1
fi
if [ $2 != boolean ]; then
echo "general/enabled has unexpected type $2"
return 2
fi
if [ $# -ne 3 ]; then
echo "general/enabled has wrong number of values"
return 3
fi
value=$3
\&...
.fi
.in -2
.sp
.LP
\fBExample 7 \fRUsing \fBsvcprop\fR in a Script
.sp
.in +2
.nf
example% cat getval
#!/bin/sh
svcprop -p $1 $2 | (
read value v2
if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
echo $value
)
.fi
.in -2
.sp
.SH EXIT STATUS
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 5n
Successful completion.
.RE
.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 5n
An error occurred.
.RE
.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.RS 5n
Invalid command line options were specified.
.RE
.SH SEE ALSO
.BR svcs (1),
.BR service_bundle (5),
.BR attributes (7),
.BR fnmatch (7),
.BR smf (7),
.BR smf_method (7),
.BR smf_security (7),
.BR zones (7),
.BR inetd (8),
.BR svc.startd (8),
.BR svcadm (8),
.BR svccfg (8)
|