'\" te .\" Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. .TH svcprop 1 "28 Jan 2014" "SunOS 5.11" "User Commands" .SH NAME svcprop \- retrieve values of service configuration properties .SH SYNOPSIS .LP .nf \fBsvcprop\fR [\fB-afqtv\fR] [\fB-C\fR | \fB-c\fR | \fB-s\fR \fIsnapshot\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR]... [ \fB-g\fR \fIpgtype\fR]... \fB-l\fR \fIlayer\fR[,...] {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fBsvcprop\fR \fB-w\fR [\fB-fqtv\fR] [\fB-p\fR [\fIname\fR/]\fIname\fR] {\fIFMRI\fR | \fIpattern\fR} .fi .SH DESCRIPTION .sp .LP The \fBsvcprop\fR utility prints values of properties in the service configuration repository. Properties are selected by \fB-p\fR options and the operands. If \fB-p\fR is not used to specifically select a property or property group, \fBsvcprop\fR will not print SMF template definition properties. More SMF infrastructure properties may be hidden from the default output in future releases. If \fB-a\fR is used, all properties, including SMF template definition properties, will be displayed. .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 non-persistent property groups in the composed view of the instance's directly attached properties. See \fBsmf\fR(5) 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" .sp .LP 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 .sp .LP The following options are supported: .sp .ne 2 .mk .na \fB\fB-a\fR\fR .ad .sp .6 .RS 4n Display all properties, including those in SMF template definition property groups. .RE .sp .ne 2 .mk .na \fB\fB-C\fR\fR .ad .sp .6 .RS 4n Uses the directly attached properties, without composition. .RE .sp .ne 2 .mk .na \fB\fB-c\fR\fR .ad .sp .6 .RS 4n For service instances, uses the composed view of their directly attached properties. .RE .sp .ne 2 .mk .na \fB\fB-f\fR\fR .ad .sp .6 .RS 4n Selects the multi-property output format, with full FMRIs as designators. .RE .sp .ne 2 .mk .na \fB\fB-g\fR \fIpgtype\fR\fR .ad .sp .6 .RS 4n Display only the selected properties belonging to property groups of type \fIpgtype\fR. Multiple \fB-g\fR options will display properties from multiple properties group types. This option implies multi-property output format (\fB-t\fR). .RE .sp .ne 2 .mk .na \fB\fB-l\fR \fIlayer\fR[,...]\fR .ad .sp .6 .RS 4n Display only the properties defined at the selected layers. Available layers are \fBmanifest\fR, \fBsystem-profile\fR, \fBsite-profile\fR, and \fBadmin\fR. The alias \fBall\fR is available to select all layers. Properties that belong to non-persistent property groups will not be displayed when this option is used. .RE .sp .ne 2 .mk .na \fB\fB-p\fR \fIname\fR\fR .ad .sp .6 .RS 4n 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. If used with \fB-g\fR, selects the \fIname\fR property for all matching property group types. .RE .sp .ne 2 .mk .na \fB\fB-p\fR \fIpg\fR/\fIprop\fR\fR .ad .sp .6 .RS 4n 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 .mk .na \fB\fB-q\fR\fR .ad .sp .6 .RS 4n Quiet. Produces no output. .RE .sp .ne 2 .mk .na \fB\fB-s\fR \fIname\fR\fR .ad .sp .6 .RS 4n Uses the composed view of the \fIname\fR snapshot for service instances. .RE .sp .ne 2 .mk .na \fB\fB-t\fR\fR .ad .sp .6 .RS 4n Selects the multi-property output format. .RE .sp .ne 2 .mk .na \fB\fB-v\fR\fR .ad .sp .6 .RS 4n Verbose. Prints error messages for nonexistent properties, even if option -q is also used. .RE .sp .ne 2 .mk .na \fB\fB-w\fR\fR .ad .sp .6 .RS 4n 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 .SH OPERANDS .sp .LP The following operands are supported: .sp .ne 2 .mk .na \fB\fIFMRI\fR\fR .ad .sp .6 .RS 4n 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 mailnetwork network/smt .fi .in -2 .sp Abbreviated forms of FMRIs are Uncommitted 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 .mk .na \fBpattern\fR .ad .sp .6 .RS 4n A glob pattern which is matched against the FMRIs of services and instances in the repository. See \fBfnmatch\fR(5). If a pattern matches multiple services or instances, \fBsvcprop\fR acts on each service or instance. .RE .SH EXAMPLES .LP \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 Uncommitted general/single_instance boolean true .fi .in -2 .sp .LP \fBExample 4 \fRTesting the Existance 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 .LP The following example gets the value of a service property and uses it in a script (\fB/usr/bin/Xserver\fR): .sp .in +2 .nf fmri=$1 prop=$2 if svcprop -q -p ${prop} ${fmri} ; then propval="$(svcprop -p ${prop} "${fmri}")" if [[ "${propval}" == "\"\"" ]] ; then propval="" fi fi .fi .in -2 .LP \fBExample 8 \fRFiltering Output by Property Group Type .sp .LP The following example gets the methods for \fBsvc:/network/ssh:default\fR .sp .in +2 .nf example% \fBsvcprop -p exec -g method svc:/network/ssh:default\fR start/exec astring /lib/svc/method/sshd\e start stop/exec astring :kill refresh/exec astring /lib/svc/method/sshd\e restart unconfigure/exec astring /lib/svc/method/sshd\e -u .fi .in -2 .sp .LP \fBExample 9 \fRDisplaying Administratively Customized Properties .sp .LP The following command uses SMF layers to display administratively customized properties. .sp .in +2 .nf example% \fBsvcprop -p config -l admin svc:/network/dns/client\fR config/domain astring admin my.domain.com config/nameserver net_address admin 10.22.33.44 10.44.33.11 .fi .in -2 .sp .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .sp .6 .RS 4n Successful completion. .RE .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .sp .6 .RS 4n An error occurred. .RE .sp .ne 2 .mk .na \fB\fB2\fR\fR .ad .sp .6 .RS 4n Invalid command line options were specified. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os .TE .SH SEE ALSO .sp .LP \fBsvcs\fR(1), \fBinetd\fR(1M), \fBsvcadm\fR(1M), \fBsvccfg\fR(1M), \fBsvc.startd\fR(1M), \fBservice_bundle\fR(4), \fBattributes\fR(5), \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5)