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.man.txt
+++ new/usr/src/man/man1/svcprop.1.man.txt
1 1 SVCPROP(1) User Commands SVCPROP(1)
2 2
3 3
4 4
5 5 NAME
6 6 svcprop - retrieve values of service configuration properties
7 7
8 8 SYNOPSIS
9 9 svcprop [-fqtv] [-C | -c | -s snapshot]
10 10 [-z zone] [-p [name/]name]...
11 11 {FMRI | pattern}...
12 12
13 13
14 14 svcprop -w [-fqtv] [-z zone] [-p [name/]name] {FMRI | pattern}
15 15
16 16
17 17 DESCRIPTION
18 18 The svcprop utility prints values of properties in the service
19 19 configuration repository. Properties are selected by -p options and the
20 20 operands.
21 21
22 22
23 23 Without the -C, -c, or -s options, svcprop accesses effective
24 24 properties. The effective properties of a service are its directly
25 25 attached properties. The effective properties of a service instance are
26 26 the union of properties in the composed view of its running snapshot
27 27 and the properties in nonpersistent property groups in the composed
28 28 view of the instance's directly attached properties. See smf(5) for an
29 29 explanation of property composition. If the running snapshot does not
30 30 exist then the instance's directly attached properties are used
31 31 instead.
32 32
33 33 Output Format
34 34 By default, when a single property is selected, the values for each are
35 35 printed on separate lines. Empty ASCII string values are represented by
36 36 a pair of double quotes (""). Bourne shell metacharacters (';', '&',
37 37 '(', ')', '|', '^', '<', '>', newline, space, tab, backslash, '"',
38 38 single-quote, '`') in ASCII string values are quoted by backslashes
39 39 (\).
40 40
41 41
42 42 When multiple properties are selected, a single line is printed for
43 43 each. Each line comprises a property designator, a property type, and
44 44 the values (as described above), separated by spaces. By default, if a
45 45 single FMRI operand has been supplied, the property designator consists
46 46 of the property group name and the property name joined by a slash (/).
47 47 If multiple FMRI operands are supplied, the designator is the canonical
48 48 FMRI for the property.
49 49
50 50
51 51 If access controls prohibit reading the value of a property, and no
52 52 property or property group is specified explicitly by a -p option, the
53 53 property is displayed as if it had no values. If one or more property
54 54 or property group names is specified by a -p option, and any property
55 55 value cannot be read due to access controls, an error results.
56 56
57 57
58 58 Error messages are printed to the standard error stream.
59 59
60 60 OPTIONS
61 61 The following options are supported:
62 62
63 63 -C
64 64 Uses the directly attached properties, without
65 65 composition.
66 66
67 67
68 68 -c
69 69 For service instances, uses the composed view of their
70 70 directly attached properties.
71 71
72 72
73 73 -f
74 74 Selects the multi-property output format, with full FMRIs
75 75 as designators.
76 76
77 77
78 78 -p name
79 79 For each service or service instance specified by the
80 80 operands, selects all properties in the name property
81 81 group. For property groups specified by the operands,
82 82 selects the name property.
83 83
84 84
85 85 -p pg/prop
86 86 Selects property prop in property group pg for each of
87 87 the services or service instances specified by the
88 88 operands.
89 89
90 90
91 91 -q
92 92 Quiet. Produces no output.
93 93
94 94
95 95 -s name
96 96 Uses the composed view of the name snapshot for service
97 97 instances.
98 98
99 99
100 100 -t
101 101 Selects the multi-property output format.
102 102
103 103
104 104 -v
105 105 Verbose. Prints error messages for nonexistent
106 106 properties, even if option -q is also used.
107 107
108 108
109 109 -w
110 110 Waits until the specified property group or the property
111 111 group containing the specified property changes before
112 112 printing.
113 113
114 114 This option is only valid when a single entity is
115 115 specified. If more than one operand is specified, or an
116 116 operand matches more than one instance, an error message
117 117 is printed and no action is taken. The -C option is
118 118 implied.
119 119
120 120
121 121 -z zone
122 122 Uses properties from the service or instance in the
123 123 specified zone. This option is only applicable from the
124 124 global zone, see zones(5).
125 125
126 126
127 127 OPERANDS
128 128 The following operands are supported:
129 129
130 130 FMRI
131 131 The FMRI of a service, a service instance, a property group,
132 132 or a property.
133 133
134 134 Instances and services can be abbreviated by specifying the
135 135 instance name, or the trailing portion of the service name.
136 136 Properties and property groups must be specified by a full
137 137 FMRI. For example, given the FMRI:
138 138
139 139 svc:/network/smtp:sendmail
140 140
141 141
142 142 The following are valid abbreviations:
143 143
144 144 sendmail
145 145 :sendmail
146 146 smtp
147 147 smtp:sendmail
148 148 network/smtp
149 149
150 150
151 151 The following are invalid abbreviations:
152 152
153 153 mail
154 154 network
155 155 network/smt
156 156
157 157
158 158 Abbreviated forms of FMRIs are unstable and should not be
159 159 used in scripts or other permanent tools. If an abbreviation
160 160 matches multiple instances, svcprop acts on each instance.
161 161
162 162
163 163 pattern
164 164 A glob pattern which is matched against the FMRIs of
165 165 services and instances in the repository. See fnmatch(5). If
166 166 a pattern matches multiple services or instances, svcprop
167 167 acts on each service or instance.
168 168
169 169
170 170 EXAMPLES
171 171 Example 1 Displaying the Value of a Single Property
172 172
173 173
174 174 The following example displays the value of the state property in the
175 175 restarter property group of instance default of service system/cron.
176 176
177 177
178 178 example% svcprop -p restarter/state system/cron:default
179 179 online
180 180
181 181
182 182
183 183 Example 2 Retrieving Whether a Service is Enabled
184 184
185 185
186 186 Whether a service is enabled is determined by its -general/enabled
187 187 property. This property takes immediate effect, so the -c option must
188 188 be used:
189 189
190 190
191 191 example% svcprop -c -p general/enabled system/cron:default
192 192 true
193 193
194 194
195 195
196 196 Example 3 Displaying All Properties in a Property Group
197 197
↓ open down ↓ |
197 lines elided |
↑ open up ↑ |
198 198
199 199 On a default installation of Solaris, the following example displays
200 200 all properties in the general property group of each instance of the
201 201 network/ntp service:
202 202
203 203
204 204 example% svcprop -p general ntp
205 205 general/package astring SUNWntpr
206 206 general/enabled boolean true
207 207 general/entity_stability astring Unstable
208 - general/single_instance boolean true
209 208
210 209
211 210
212 211 Example 4 Testing the Existence of a Property
213 212
214 213
215 214 The following example tests the existence of the general/enabled
216 215 property for all instances of service identity:
217 216
218 217
219 218 example% svcprop -q -p general/enabled identity:
220 219 example% echo $?
221 220 0
222 221
223 222
224 223
225 224 Example 5 Waiting for Property Change
226 225
227 226
228 227 The following example waits for the sendmail instance to change state.
229 228
230 229
231 230 example% svcprop -w -p restarter/state sendmail
232 231
233 232
234 233
235 234 Example 6 Retrieving the Value of a Boolean Property in a Script
236 235
237 236
238 237 The following example retrieves the value of a boolean property in a
239 238 script:
240 239
241 240
242 241 set -- `svcprop -c -t -p general/enabled service`
243 242 code=$?
244 243 if [ $code -ne 0 ]; then
245 244 echo "svcprop failed with exit code $code"
246 245 return 1
247 246 fi
248 247 if [ $2 != boolean ]; then
249 248 echo "general/enabled has unexpected type $2"
250 249 return 2
251 250 fi
252 251 if [ $# -ne 3 ]; then
253 252 echo "general/enabled has wrong number of values"
254 253 return 3
255 254 fi
256 255 value=$3
257 256 ...
258 257
259 258
260 259
261 260 Example 7 Using svcprop in a Script
262 261
263 262 example% cat getval
264 263 #!/bin/sh
265 264
266 265 svcprop -p $1 $2 | (
267 266 read value v2
268 267 if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
269 268 echo $value
270 269 )
271 270
272 271
273 272
274 273 EXIT STATUS
275 274 The following exit values are returned:
276 275
277 276 0
278 277 Successful completion.
279 278
280 279
281 280 1
282 281 An error occurred.
283 282
284 283
285 284 2
↓ open down ↓ |
67 lines elided |
↑ open up ↑ |
286 285 Invalid command line options were specified.
287 286
288 287
289 288 SEE ALSO
290 289 svcs(1), inetd(1M), svcadm(1M), svccfg(1M), svc.startd(1M),
291 290 service_bundle(4), attributes(5), fnmatch(5), smf(5), smf_method(5),
292 291 smf_security(5), zones(5)
293 292
294 293
295 294
296 - April 9, 2016 SVCPROP(1)
295 + December 11, 2019 SVCPROP(1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX