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