Print this page
12071 clarify implementation of single_instance in SMF services
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
   1 '\" te
   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"
   7 .SH NAME
   8 svcprop \- retrieve values of service configuration properties
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  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}...
  15 .fi
  16 
  17 .LP
  18 .nf
  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 .fi
  21 
  22 .SH DESCRIPTION
  23 .LP
  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
  26 operands.
  27 .sp
  28 .LP
  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.
  37 .SS "Output Format"
  38 .LP
  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).
  45 .sp
  46 .LP
  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
  53 for the property.
  54 .sp
  55 .LP
  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.
  61 .sp
  62 .LP
  63 Error messages are printed to the standard error stream.
  64 .SH OPTIONS
  65 .LP
  66 The following options are supported:
  67 .sp
  68 .ne 2
  69 .na
  70 \fB\fB-C\fR\fR
  71 .ad
  72 .RS 14n
  73 Uses the directly attached properties, without composition.
  74 .RE
  75 
  76 .sp
  77 .ne 2
  78 .na
  79 \fB\fB-c\fR\fR
  80 .ad
  81 .RS 14n
  82 For service instances, uses the composed view of their directly attached
  83 properties.
  84 .RE
  85 


 157 .ad
 158 .RS 14n
 159 Waits until the specified property group or the property group containing the
 160 specified property changes before printing.
 161 .sp
 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.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB-z\fR \fIzone\fR
 171 .ad
 172 .RS 14n
 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).
 175 
 176 .SH OPERANDS
 177 .LP
 178 The following operands are supported:
 179 .sp
 180 .ne 2
 181 .na
 182 \fB\fIFMRI\fR\fR
 183 .ad
 184 .RS 11n
 185 The FMRI of a service, a service instance, a property group, or a property.
 186 .sp
 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:
 190 .sp
 191 .in +2
 192 .nf
 193 svc:/network/smtp:sendmail
 194 .fi
 195 .in -2
 196 .sp
 197 


 219 .in -2
 220 .sp
 221 
 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.
 225 .RE
 226 
 227 .sp
 228 .ne 2
 229 .na
 230 \fBpattern\fR
 231 .ad
 232 .RS 11n
 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.
 236 .RE
 237 
 238 .SH EXAMPLES
 239 .LP
 240 \fBExample 1 \fRDisplaying the Value of a Single Property
 241 .sp
 242 .LP
 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.
 245 
 246 .sp
 247 .in +2
 248 .nf
 249 example%  svcprop -p restarter/state system/cron:default
 250 online
 251 .fi
 252 .in -2
 253 .sp
 254 
 255 .LP
 256 \fBExample 2 \fRRetrieving Whether a Service is Enabled
 257 .sp
 258 .LP
 259 Whether a service is enabled is determined by its \fB-general/enabled\fR


 267 true
 268 .fi
 269 .in -2
 270 .sp
 271 
 272 .LP
 273 \fBExample 3 \fRDisplaying All Properties in a Property Group
 274 .sp
 275 .LP
 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:
 279 
 280 .sp
 281 .in +2
 282 .nf
 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
 288 .fi
 289 .in -2
 290 .sp
 291 
 292 .LP
 293 \fBExample 4 \fRTesting the Existence of a Property
 294 .sp
 295 .LP
 296 The following example tests the existence of the \fBgeneral/enabled\fR property
 297 for all instances of service identity:
 298 
 299 .sp
 300 .in +2
 301 .nf
 302 example%  svcprop -q -p general/enabled identity:
 303 example%  echo $?
 304 0
 305 .fi
 306 .in -2
 307 .sp


 350 .sp
 351 
 352 .LP
 353 \fBExample 7 \fRUsing \fBsvcprop\fR in a Script
 354 .sp
 355 .in +2
 356 .nf
 357 example% cat getval
 358 #!/bin/sh
 359 
 360 svcprop -p $1 $2 | (
 361          read value v2
 362          if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
 363          echo $value
 364        )
 365 .fi
 366 .in -2
 367 .sp
 368 
 369 .SH EXIT STATUS
 370 .LP
 371 The following exit values are returned:
 372 .sp
 373 .ne 2
 374 .na
 375 \fB\fB0\fR\fR
 376 .ad
 377 .RS 5n
 378 Successful completion.
 379 .RE
 380 
 381 .sp
 382 .ne 2
 383 .na
 384 \fB\fB1\fR\fR
 385 .ad
 386 .RS 5n
 387 An error occurred.
 388 .RE
 389 
 390 .sp
 391 .ne 2
 392 .na
 393 \fB\fB2\fR\fR
 394 .ad
 395 .RS 5n
 396 Invalid command line options were specified.
 397 .RE
 398 
 399 .SH SEE ALSO
 400 .LP
 401 \fBsvcs\fR(1), \fBinetd\fR(1M), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M),
 402 \fBsvc.startd\fR(1M), \fBservice_bundle\fR(4), \fBattributes\fR(5),
 403 \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5),
 404 \fBzones\fR(5)
   1 '\" te
   2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
   3 .\" Copyright 2019 Joyent, Inc.
   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.
   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.
   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]
   7 .TH SVCPROP 1 "Dec 11, 2019"
   8 .SH NAME
   9 svcprop \- retrieve values of service configuration properties
  10 .SH SYNOPSIS

  11 .nf
  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}...
  15 .fi
  16 
  17 .LP
  18 .nf
  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 .fi
  21 
  22 .SH DESCRIPTION

  23 The \fBsvcprop\fR utility prints values of properties in the service
  24 configuration repository. Properties are selected by \fB-p\fR options and the
  25 operands.
  26 .sp
  27 .LP
  28 Without the \fB-C\fR, \fB-c\fR, or \fB-s\fR options, \fBsvcprop\fR accesses
  29 effective properties. The effective properties of a service are its directly
  30 attached properties. The effective properties of a service instance are the
  31 union of properties in the composed view of its \fBrunning\fR snapshot and the
  32 properties in nonpersistent property groups in the composed view of the
  33 instance's directly attached properties. See \fBsmf\fR(5) for an explanation of
  34 property composition. If the \fBrunning\fR snapshot does not exist then the
  35 instance's directly attached properties are used instead.
  36 .SS "Output Format"

  37 By default, when a single property is selected, the values for each are printed
  38 on separate lines. Empty \fBASCII\fR string values are represented by a pair of
  39 double quotes (\fB""\fR). Bourne shell metacharacters ('\fB;\fR', '\fB&\fR\&',
  40 \&'\fB(\fR', '\fB)\fR', '\fB|\fR', '\fB^\fR', '\fB<\fR\&', '\fB>\fR', newline,
  41 space, tab, backslash, '\fB"\fR', single-quote, '\fB`\fR') in \fBASCII\fR
  42 string values are quoted by backslashes (\fB\e\fR).
  43 .sp
  44 .LP
  45 When multiple properties are selected, a single line is printed for each. Each
  46 line comprises a property designator, a property type, and the values (as
  47 described above), separated by spaces. By default, if a single \fIFMRI\fR
  48 operand has been supplied, the property designator consists of the property
  49 group name and the property name joined by a slash (\fB/\fR). If multiple
  50 \fIFMRI\fR operands are supplied, the designator is the canonical \fIFMRI\fR
  51 for the property.
  52 .sp
  53 .LP
  54 If access controls prohibit reading the value of a property, and no property or
  55 property group is specified explicitly by a \fB-p\fR option, the property is
  56 displayed as if it had no values. If one or more property or property group
  57 names is specified by  a \fB-p\fR option, and any property value cannot be read
  58 due to access controls, an error results.
  59 .sp
  60 .LP
  61 Error messages are printed to the standard error stream.
  62 .SH OPTIONS

  63 The following options are supported:
  64 .sp
  65 .ne 2
  66 .na
  67 \fB\fB-C\fR\fR
  68 .ad
  69 .RS 14n
  70 Uses the directly attached properties, without composition.
  71 .RE
  72 
  73 .sp
  74 .ne 2
  75 .na
  76 \fB\fB-c\fR\fR
  77 .ad
  78 .RS 14n
  79 For service instances, uses the composed view of their directly attached
  80 properties.
  81 .RE
  82 


 154 .ad
 155 .RS 14n
 156 Waits until the specified property group or the property group containing the
 157 specified property changes before printing.
 158 .sp
 159 This option is only valid when a single entity is specified. If more than one
 160 operand is specified, or an operand matches more than one instance, an error
 161 message is printed and no action is taken. The -C option is implied.
 162 .RE
 163 
 164 .sp
 165 .ne 2
 166 .na
 167 \fB-z\fR \fIzone\fR
 168 .ad
 169 .RS 14n
 170 Uses properties from the service or instance in the specified \fIzone\fR.
 171 This option is only applicable from the global zone, see \fBzones\fR(5).
 172 
 173 .SH OPERANDS

 174 The following operands are supported:
 175 .sp
 176 .ne 2
 177 .na
 178 \fB\fIFMRI\fR\fR
 179 .ad
 180 .RS 11n
 181 The FMRI of a service, a service instance, a property group, or a property.
 182 .sp
 183 Instances and services can be abbreviated by specifying the instance name, or
 184 the trailing portion of the service name. Properties and property groups must
 185 be specified by a full FMRI. For example, given the FMRI:
 186 .sp
 187 .in +2
 188 .nf
 189 svc:/network/smtp:sendmail
 190 .fi
 191 .in -2
 192 .sp
 193 


 215 .in -2
 216 .sp
 217 
 218 Abbreviated forms of FMRIs are unstable and should not be used in scripts or
 219 other permanent tools. If an abbreviation matches multiple instances,
 220 \fBsvcprop\fR acts on each instance.
 221 .RE
 222 
 223 .sp
 224 .ne 2
 225 .na
 226 \fBpattern\fR
 227 .ad
 228 .RS 11n
 229 A glob pattern which is matched against the FMRIs of services and instances in
 230 the repository. See \fBfnmatch\fR(5). If a pattern matches multiple services or
 231 instances, \fBsvcprop\fR acts on each service or instance.
 232 .RE
 233 
 234 .SH EXAMPLES

 235 \fBExample 1 \fRDisplaying the Value of a Single Property
 236 .sp
 237 .LP
 238 The following example displays the value of the state property in the restarter
 239 property group of instance \fBdefault\fR of service \fBsystem/cron\fR.
 240 
 241 .sp
 242 .in +2
 243 .nf
 244 example%  svcprop -p restarter/state system/cron:default
 245 online
 246 .fi
 247 .in -2
 248 .sp
 249 
 250 .LP
 251 \fBExample 2 \fRRetrieving Whether a Service is Enabled
 252 .sp
 253 .LP
 254 Whether a service is enabled is determined by its \fB-general/enabled\fR


 262 true
 263 .fi
 264 .in -2
 265 .sp
 266 
 267 .LP
 268 \fBExample 3 \fRDisplaying All Properties in a Property Group
 269 .sp
 270 .LP
 271 On a default installation of Solaris, the following example displays all
 272 properties in the \fBgeneral\fR property group of each instance of the
 273 \fBnetwork/ntp\fR service:
 274 
 275 .sp
 276 .in +2
 277 .nf
 278 example% svcprop -p general ntp
 279 general/package astring SUNWntpr
 280 general/enabled boolean true
 281 general/entity_stability astring Unstable

 282 .fi
 283 .in -2
 284 .sp
 285 
 286 .LP
 287 \fBExample 4 \fRTesting the Existence of a Property
 288 .sp
 289 .LP
 290 The following example tests the existence of the \fBgeneral/enabled\fR property
 291 for all instances of service identity:
 292 
 293 .sp
 294 .in +2
 295 .nf
 296 example%  svcprop -q -p general/enabled identity:
 297 example%  echo $?
 298 0
 299 .fi
 300 .in -2
 301 .sp


 344 .sp
 345 
 346 .LP
 347 \fBExample 7 \fRUsing \fBsvcprop\fR in a Script
 348 .sp
 349 .in +2
 350 .nf
 351 example% cat getval
 352 #!/bin/sh
 353 
 354 svcprop -p $1 $2 | (
 355          read value v2
 356          if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
 357          echo $value
 358        )
 359 .fi
 360 .in -2
 361 .sp
 362 
 363 .SH EXIT STATUS

 364 The following exit values are returned:
 365 .sp
 366 .ne 2
 367 .na
 368 \fB\fB0\fR\fR
 369 .ad
 370 .RS 5n
 371 Successful completion.
 372 .RE
 373 
 374 .sp
 375 .ne 2
 376 .na
 377 \fB\fB1\fR\fR
 378 .ad
 379 .RS 5n
 380 An error occurred.
 381 .RE
 382 
 383 .sp
 384 .ne 2
 385 .na
 386 \fB\fB2\fR\fR
 387 .ad
 388 .RS 5n
 389 Invalid command line options were specified.
 390 .RE
 391 
 392 .SH SEE ALSO

 393 \fBsvcs\fR(1), \fBinetd\fR(1M), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M),
 394 \fBsvc.startd\fR(1M), \fBservice_bundle\fR(4), \fBattributes\fR(5),
 395 \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5),
 396 \fBzones\fR(5)