man pages section 1: User Commands

Exit Print View

Updated: July 2014



svcprop - retrieve values of service configuration properties


svcprop [-afqtv] [-C | -c | -s snapshot] [-p [name/]name]... 
     [ -g pgtype]... -l layer[,...] {FMRI | pattern}...
svcprop -w [-fqtv] [-p [name/]name] {FMRI | pattern}


The svcprop utility prints values of properties in the service configuration repository. Properties are selected by –p options and the operands. If –p is not used to specifically select a property or property group, svcprop will not print SMF template definition properties. More SMF infrastructure properties may be hidden from the default output in future releases. If –a is used, all properties, including SMF template definition properties, will be displayed.

Without the –C, –c, or –s options, svcprop 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 running snapshot and the properties in non-persistent property groups in the composed view of the instance's directly attached properties. See smf(5) for an explanation of property composition. If the running snapshot does not exist then the instance's directly attached properties are used instead.

Output Format

By default, when a single property is selected, the values for each are printed on separate lines. Empty ASCII string values are represented by a pair of double quotes (“”). Bourne shell metacharacters (';', '&', '(', ')', '|', '^', '<', '>', newline, space, tab, backslash, '"', single-quote, '`') in ASCII string values are quoted by backslashes (\).

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 FMRI operand has been supplied, the property designator consists of the property group name and the property name joined by a slash (/). If multiple FMRI operands are supplied, the designator is the canonical FMRI for the property.

If access controls prohibit reading the value of a property, and no property or property group is specified explicitly by a –p option, the property is displayed as if it had no values. If one or more property or property group names is specified by a –p option, and any property value cannot be read due to access controls, an error results.

Error messages are printed to the standard error stream.


The following options are supported:


Display all properties, including those in SMF template definition property groups.


Uses the directly attached properties, without composition.


For service instances, uses the composed view of their directly attached properties.


Selects the multi-property output format, with full FMRIs as designators.

–g pgtype

Display only the selected properties belonging to property groups of type pgtype. Multiple –g options will display properties from multiple properties group types. This option implies multi-property output format (–t).

–l layer[,...]

Display only the properties defined at the selected layers. Available layers are manifest, system-profile, site-profile, and admin. The alias all is available to select all layers. Properties that belong to non-persistent property groups will not be displayed when this option is used.

–p name

For each service or service instance specified by the operands, selects all properties in the name property group. For property groups specified by the operands, selects the name property. If used with –g, selects the name property for all matching property group types.

–p pg/prop

Selects property prop in property group pg for each of the services or service instances specified by the operands.


Quiet. Produces no output.

–s name

Uses the composed view of the name snapshot for service instances.


Selects the multi-property output format.


Verbose. Prints error messages for nonexistent properties, even if option -q is also used.


Waits until the specified property group or the property group containing the specified property changes before printing.

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.


The following operands are supported:


The FMRI of a service, a service instance, a property group, or a property.

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:


The following are valid abbreviations:


The following are invalid abbreviations:


Abbreviated forms of FMRIs are Uncommitted and should not be used in scripts or other permanent tools. If an abbreviation matches multiple instances, svcprop acts on each instance.


A glob pattern which is matched against the FMRIs of services and instances in the repository. See fnmatch(5). If a pattern matches multiple services or instances, svcprop acts on each service or instance.


Example 1 Displaying the Value of a Single Property

The following example displays the value of the state property in the restarter property group of instance default of service system/cron.

example%  svcprop -p restarter/state system/cron:default

Example 2 Retrieving Whether a Service is Enabled

Whether a service is enabled is determined by its –general/enabled property. This property takes immediate effect, so the –c option must be used:

example%  svcprop -c -p general/enabled system/cron:default

Example 3 Displaying All Properties in a Property Group

On a default installation of Solaris, the following example displays all properties in the general property group of each instance of the network/ntp service:

example% svcprop -p general ntp
general/package astring SUNWntpr
general/enabled boolean true
general/entity_stability astring Uncommitted
general/single_instance boolean true

Example 4 Testing the Existance of a Property

The following example tests the existence of the general/enabled property for all instances of service identity:

example%  svcprop -q -p general/enabled identity:
example%  echo $?

Example 5 Waiting for Property Change

The following example waits for the sendmail instance to change state.

example%  svcprop -w -p restarter/state sendmail
Example 6 Retrieving the Value of a Boolean Property in a Script

The following example retrieves the value of a boolean property in a script:

set -- `svcprop -c -t -p general/enabled service`
if [ $code -ne 0 ]; then
        echo "svcprop failed with exit code $code"           
        return 1
if [ $2 != boolean ]; then
         echo "general/enabled has unexpected type $2"
         return 2
if [ $# -ne 3 ]; then
          echo "general/enabled has wrong number of values"
          return 3
Example 7 Using svcprop in a Script

The following example gets the value of a service property and uses it in a script (/usr/bin/Xserver):

if svcprop -q -p ${prop} ${fmri} ; then
     propval="$(svcprop -p ${prop} "${fmri}")"
     if [[ "${propval}" == "\"\"" ]] ; then
Example 8 Filtering Output by Property Group Type

The following example gets the methods for svc:/network/ssh:default

example% svcprop -p exec -g method svc:/network/ssh:default
start/exec astring /lib/svc/method/sshd\ start
stop/exec astring :kill
refresh/exec astring /lib/svc/method/sshd\ restart
unconfigure/exec astring /lib/svc/method/sshd\ -u
Example 9 Displaying Administratively Customized Properties

The following command uses SMF layers to display administratively customized properties.

example% svcprop -p config -l admin svc:/network/dns/client
config/domain       astring     admin
config/nameserver   net_address admin

Exit Status

The following exit values are returned:


Successful completion.


An error occurred.


Invalid command line options were specified.


See attributes(5) for descriptions of the following attributes:


See also

svcs(1), inetd(1M), svcadm(1M), svccfg(1M), svc.startd(1M), service_bundle(4) , attributes(5), fnmatch(5) , smf(5), smf_method(5) , smf_security(5)