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