Go to main content

Managing System Services in Oracle® Solaris 11.4

Exit Print View

Updated: Febuary 2019
 
 

Inspecting Service Configuration

Service configuration is expressed in properties that are set on services and service instances and stored in layers in the service configuration repository. Properties that are set on a service are inherited by all instances of that service. Properties that are set on an instance are used only by that instance. Service instances can customize the values of inherited properties and can define additional properties that are not defined for the parent service.

This section shows how to retrieve property values and how to identify whether the value is global for the service, is specific to an instance, was delivered with the software, or is an administrative customization.

Showing Descriptions of Properties and Property Groups

The svccfg describe command displays a description of the property groups and properties of a service, including the current values of properties. With no operands, describe shows descriptions of all property groups and properties of the selected service or service instance. Use the -v option to show more information, including a description of the current value and a list of possible values. Use the -t option to show template information.

$ svccfg -s pkg/server describe network/restart_on
network/restart_on astring     none
    Determines whether to restart the service due to a dependency refresh, restart, or failure.
$ svccfg -s pkg/server describe -v network/restart_on
network/restart_on astring     none
    type: astring
    required: true
    Determines whether to restart the service due to a dependency refresh, restart, or failure.
    visibility: readwrite
    minimum number of values: 1
    maximum number of values: 1
  value: none
    value description: Never restart due to dependency refresh, restart, or failure.
  value constraints:
    value name: none
    value name: error
    value name: restart
    value name: refresh

Showing Service and Instance Property Values

The examples in this section describe how to view service and instance properties and property groups in different views, layers, and snapshots. Note the following definitions. For descriptions of layers and snapshots, see Service Configuration Repository.

committed properties

Property values that are currently effective. The svcprop command shows committed properties by default. Use the svcprop command with the -c option to show any property values that are not yet committed.

composed view

Properties that are inherited from the parent service and properties that are defined on the instance. If a property that is defined in the parent service is customized in the instance, the customized value is shown. The svcprop command shows the composed view by default.

directly attached properties

Property values that are not committed. The property has been set on the instance or on the parent service but the instance has not been refreshed. When you refresh the instance, a running snapshot is taken and the property becomes committed. Use the svcprop command with the -c option or the -C option to view directly attached properties.

editing view

The most recent property changes that are not committed.

Example 6  Listing Instance and Inherited Properties Currently in Use

By default, the svcprop command shows the values assigned to properties in the running snapshot, which are the values currently being used. By default, the svcprop command shows properties in the composed view of the running snapshot, which means that both instance-specific properties and inherited properties are shown. If the value of an inherited property is customized in the instance, the value set in the instance is shown. The output lists one line for each property, showing the property group and property name separated by a forward slash character, the data type of the property value, and the property value. If no property or group name is specified, all property values in the running snapshot are shown.

If the FMRI or pattern operand specifies the full service name but does not specify an instance, properties set only on the service are shown. Properties set only on an instance are not shown. The following command shows properties such as service dependencies, the type of the service, and the paths of the profile and manifest files.

$ svcprop svc:/system/identity

When you specify an instance, you see the composed view of properties customized for that instance and properties inherited from the parent service. The following command lists all the properties in the running snapshot for the specified instance, including properties inherited from the parent service and properties specific to this instance. For inherited properties whose value is customized for this instance, the customized value is shown. This example shows properties such as additional dependencies, the path to the executable that starts this instance, the path to the log file for this instance, and information about the state of this instance.

$ svcprop svc:/system/identity:domain

See also the use of the -c option in Example 8, Listing Service and Instance Values in the Editing View.

Example 7  Listing Specified Properties or Property Groups Currently in Use

Use the -p option to show specific properties or all properties in a specific property group. The following example shows the value of a specific property:

$ svcprop -p config/prop1 example
svc:/site/example:default/:properties/config/prop1 count 1
svc:/site/example:newinst/:properties/config/prop1 count 1

You can specify the -p option multiple times:

$ svcprop -p config/prop1 -p config/prop2 example
svc:/site/example:default/:properties/config/prop1 count 1
svc:/site/example:default/:properties/config/prop2 count 2
svc:/site/example:newinst/:properties/config/prop1 count 1
svc:/site/example:newinst/:properties/config/prop2 count 2

The following example shows the values of all properties in a specific property group:

$ svcprop -p config example
svc:/site/example:default/:properties/config/prop1 count 1
svc:/site/example:default/:properties/config/prop2 count 2
svc:/site/example:newinst/:properties/config/prop3 count 3
svc:/site/example:newinst/:properties/config/prop1 count 1
svc:/site/example:newinst/:properties/config/prop2 count 2

The following commands show that config/prop1 and config/prop2 are defined for the example parent service and not for either of the service instances. The preceding svcprop command shows all three properties because svcprop shows the composed view: properties defined for an instance plus inherited properties. The svccfg command shows only properties for the specified service instance or parent service.

$ svccfg -s example listprop config
config       application
config/prop1 count       1
config/prop2 count       2
$ svccfg -s example:default listprop config
$ svccfg -s example:newinst listprop config
config       application
config/prop3 count       3
Example 8  Listing Service and Instance Values in the Editing View

With the -C and -c options, the svcprop command shows the editing view instead of the running snapshot. The editing view shows the most recent changes. The changes in the editing view might or might not have been committed into the running snapshot by refreshing the instance. The following commands illustrate the difference between the running snapshot and the editing view.

The following command changes the value of a property of the example:default service instance:

$ svccfg -s example:default setprop config/prop1 = 11

The change does not show because the instance has not been refreshed:

$ svcprop -p config example
svc:/site/example:default/:properties/config/prop1 count 1
svc:/site/example:default/:properties/config/prop2 count 2
svc:/site/example:newinst/:properties/config/prop3 count 3
svc:/site/example:newinst/:properties/config/prop1 count 1
svc:/site/example:newinst/:properties/config/prop2 count 2

The -C option shows the new value in the editing view:

$ svcprop -C -p config example
svc:/site/example:default/:properties/config/prop1 count 11
svc:/site/example:newinst/:properties/config/prop3 count 3

The -C option shows properties that are directly attached to an instance, without composition. The newest values of instance properties are shown, and inherited properties are not shown.

The -c option shows the composed view of directly attached properties. The newest values of both instance properties and inherited properties are shown.

$ svcprop -c -p config example
svc:/site/example:default/:properties/config/prop1 count 11
svc:/site/example/:properties/config/prop2 count 2
svc:/site/example:newinst/:properties/config/prop3 count 3
svc:/site/example/:properties/config/prop1 count 1
svc:/site/example/:properties/config/prop2 count 2

The following command changes the value of a property of the example parent service:

$ svccfg -s example setprop config/prop2 = 22

This change to the parent service property is not shown by the -C option because the -C option shows properties that are directly attached to an instance:

$ svcprop -C -p config example
svc:/site/example:default/:properties/config/prop1 count 11
svc:/site/example:newinst/:properties/config/prop3 count 3

This change to the parent service property is shown by the -c option because the -c option shows the composed view:

$ svcprop -c -p config example
svc:/site/example:default/:properties/config/prop1 count 11
svc:/site/example/:properties/config/prop2 count 22
svc:/site/example:newinst/:properties/config/prop3 count 3
svc:/site/example/:properties/config/prop1 count 1
svc:/site/example/:properties/config/prop2 count 22

In the following example, new values are shown for the example:default instance because that instance is refreshed. The example:newinst instance must also be refreshed to make the new config/prop2 value the effective value for that instance.

$ svcadm refresh example:default
$ svcprop -p config example
svc:/site/example:default/:properties/config/prop1 count 11
svc:/site/example:default/:properties/config/prop2 count 22
svc:/site/example:newinst/:properties/config/prop3 count 3
svc:/site/example:newinst/:properties/config/prop1 count 1
svc:/site/example:newinst/:properties/config/prop2 count 2

The svccfg command displays the editing property values by default, not the values in the running snapshot. You can force svccfg to display values in the running snapshot by using the selectsnap subcommand as shown in Showing Values in a Specified Snapshot.

The svccfg command only shows values for the parent service when you specify a parent service and only shows values for an instance when you specify an instance. If you receive no output from the svccfg listprop command, the property you specified might not be set on the parent service or the instance that you specified. If the property was deleted, use listcust -M to view the masked value, as shown in Showing Configuration Customizations.

The following command lists all editing property values for the specified service because no property group or property name is specified. In addition to the output shown by the svcprop svc:/system/identity command, this output includes property group names and types and template data.

$ svccfg -s svc:/system/identity listprop

The following command lists all editing property values for the specified service instance. Because this command does not show the composed view, this output does not show the paths to the profile and manifest files, for example.

$ svccfg -s svc:/system/identity:domain listprop
Example 9  Listing Specified Properties or Property Groups in the Editing View

The following command lists all editing property values in the specified property group for the specified service instance. The -o option enables you to select the columns to display. See the svccfg(8) man page for the list of valid column names.

$ svccfg -s pkg/server:s11 listprop pkg
pkg                  application
pkg/inst_root       astring      /var/share/pkg/repositories/solaris
pkg/port            count        81
$ svccfg -s pkg/server:s11 listprop -o propname,value pkg
inst_root      /var/share/pkg/repositories/solaris
port           81
Example 10  Listing Properties Whose Names Include Special Characters

Naming Property Groups and Properties in Developing System Services in Oracle Solaris 11.4 provides a list of reserved characters that can be used in property group and property names. These reserved characters appear encoded in FMRIs:

$ svcprop -p config enchars_example:default
config/%25%20increase count 10
config/maximum%20%23 count 9
config/start%3Aend count 10
config/students%2Fteachers count 20

To query property groups or properties whose names contain reserved characters, copy the encoded names or use the -G and -P options:

$ svcprop -p config/%25%20increase enchars_example:default
10
$ svcprop -G config -P students/teachers enchars_example:default
20
$ svccfg -s enchars_example:default listprop -G config -P "maximum #"
config/maximum%20%23 count       9

Showing Properties in a Nested Property Group

To list properties or property values in a property group that is the child of another property group, specify the full ancestry of the property.

In the following example, http and https are child property groups of the config property group, and ssl is a child property group of the https property group:

$ svccfg -s npg_example listprop config
config                    application
config/port               count       80
config/http               application
config/http/port          count       80
config/https              application
config/https/port         count       443
config/https/ssl          application
config/https/ssl/certfile astring     cert.crt
config/https/ssl/keyfile  astring     key.crt

As in preceding examples, specifying only a top-level property group to the svcprop command shows only properties directly attached to that property group. Properties for child property groups are not shown.

$ svcprop -p config npg_example
config/port count 80
Example 11  Listing Properties in a Child Property Group

If you use the -p option of the svcprop command to view properties in a nested property group, you must include all the parent property groups. The following command lists all properties of the config/https/ssl property group:

$ svcprop -p config/https/ssl svc:/site/npg_example
config/https/ssl/certfile astring cert.crt
config/https/ssl/keyfile astring key.crt

If you use the -G option of the svcprop command to view properties in a nested property group, specify a separate -G option for each property group.

$ svcprop -G config npg_example
config/port count 80
$ svcprop -G config -G https npg_example
config/https/port count 443
$ svcprop -G config -G https -G ssl npg_example
config/https/ssl/certfile astring cert.crt
config/https/ssl/keyfile astring key.crt

As shown at the beginning of this section, the svccfg listprop command shows properties in all child property groups of the specified property group.

$ svccfg -s npg_example listprop config/https
config/https              application
config/https/port         count       443
config/https/ssl          application
config/https/ssl/certfile astring     cert.crt
config/https/ssl/keyfile  astring     key.crt
Example 12  Using a Wildcard in Place of Child Property Group Names

Wildcards can be used to replace child property group names in the svccfg listprop command.

$ svccfg -s npg_example listprop config/*port
config/port       count       80
config/http/port  count       80
config/https/port count       443

Wildcards cannot be used to replace child property group names in the svcprop command.

$ svcprop -p config/*port npg_example
svcprop: Couldn't find property group 'config/*port' for instance 
'svc:/site/npg_example:default'.
Example 13  Showing Property Values in a Child Property Group

If you use the svcprop command, specify all parent property group names.

$ svcprop -p config/https/ssl/certfile npg_example
cert.crt

If you use the -G option with the svcprop command, then you must use the -P option to specify the property name.

$ svcprop -G config -G https -G ssl -P certfile npg_example
cert.crt

If you use the svccfg command, you can specify all parent property group names or you can use a wildcard.

$ svccfg -s npg_example listprop config/https/ssl/certfile
config/https/ssl/certfile astring     cert.crt
$ svccfg -s npg_example listprop config/*file
config/https/ssl/certfile astring     cert.crt
config/https/ssl/keyfile  astring     key.crt

Showing Properties in a Property Group Type

In addition to showing property values by property name or property group name, you can also show property values by property group type.

Example 14  Showing Property Groups and Their Types

The listpg subcommand of the svccfg command shows the name and type of each property group.

$ svccfg -s pkg/server listpg
pkg             application
pkg_bui         application
pkg_secure      application
fs              dependency
autofs          dependency
ntp             dependency
network         dependency
general         framework
manifestfiles   framework
start           method
stop            method
tm_common_name  template
$ svccfg -s pkg/server:s11 listpg
pkg        application
general    framework
restarter  framework              NONPERSISTENT

Non-persistent property groups generally hold an active program state. Values of properties in non-persistent property groups are cleared during system boot.

Specify a property group name to show the type of only that property group.

$ svccfg -s pkg/mirror listpg config
config  application
Example 15  Listing Properties of a Property Group Type

Use the -g option of the svcprop command to show properties in a specific property group type.

$ svcprop -g com.sun,fw_configuration smtp
firewall_config/apply_to astring ""
firewall_config/exceptions astring ""
firewall_config/policy astring use_global
firewall_config/value_authorization astring solaris.smf.value.firewall.config

Multiple -g options show properties from property groups of all specified types.

$ svcprop -g application -g com.sun,fw_configuration smtp
config/db_version integer 5
config/include_info boolean false
config/local_only boolean true
config/path_to_sendmail_mc astring ""
config/value_authorization astring solaris.smf.value.sendmail
firewall_config/apply_to astring ""
firewall_config/exceptions astring ""
firewall_config/policy astring use_global
firewall_config/value_authorization astring solaris.smf.value.firewall.config

If you use both the -p and -g options, do not specify the name of the property group in the -p option value.

$ svcprop -g plugin -p path auditd
audit_binfile/path astring audit_binfile.so
audit_remote/path astring audit_remote.so
audit_sstore/path astring audit_sstore.so.1
audit_syslog/path astring audit_syslog.so

Showing the Layer Where a Value Is Set

The service configuration repository stores property data in layers according to the source of the data. Both the svcprop and svccfg commands can show the layer that is the source of a property value. The -l option of the svcprop and svccfg commands requires an argument to specify the layer for which you want information. Argument values are manifest, system-profile, enterprise-profile, site-profile, node-profile, sysconfig-profile, and admin. The output indicates whether a specific property value was set in the service manifest, in a profile, or by an administrator or application. See Repository Layers for descriptions of the layers. The keyword all is an alias for all layers. If the layer you specify is not the source of the property values you request, no output is shown.

The following command shows that some property values come from the service manifest and some were set by an administrator. Some properties have values in more than one layer. The pkg/readonly property has a value set in the service manifest, and an administrator also set that same value. Values from different layers could be different.

$ svcprop -l all -p pkg pkg/server:s11
pkg/port count admin 81
pkg/inst_root astring admin /var/share/pkg/repositories/solaris
pkg/address net_address manifest
pkg/cfg_file astring manifest ""
...
pkg/readonly boolean manifest true
pkg/readonly boolean admin true
...

The -l option of the svccfg listprop command can also take the argument current. Using current as the -l argument shows the same property values that are shown when you do not use the -l option. The only difference in the output is that the name of the layer is also shown. The non-persistent data does not show a layer name (the third column displays <none>) because the service configuration repository does not store layer information for non-persistent data. Non-persistent property groups generally hold an active program state, and values of properties in non-persistent property groups are cleared during system boot.

$ svccfg -s pkg/server:s11 listprop -l current
pkg                                application admin
pkg/inst_root                     astring     admin     /var/share/pkg/repositories/solaris
pkg/port                          count       admin     81
general                            framework   admin
general/complete                  astring     manifest
general/enabled                   boolean     admin     true
restarter                          framework   <none>       NONPERSISTENT
restarter/logfile                 astring      <none>    /var/svc/log/application-pkg-server:default.log
restarter/contract                count        <none>    121
restarter/start_pid               count        <none>    1055
restarter/start_method_timestamp  time         <none>    1379605275.329096000
restarter/start_method_waitstatus integer      <none>    0
restarter/auxiliary_state         astring      <none>    dependencies_satisfied
restarter/next_state              astring      <none>    none
restarter/state                   astring      <none>    online
restarter/state_timestamp         time         <none>    1379605275.332259000

Showing the File that Contributed the Configuration

The following commands show that the localtime property is set to UTC in the service manifest and set to US/Pacific in a profile in the /etc/svc/profile/node directory. The value set at the node-profile layer overrides the value set at the manifest layer.

$ svcprop -l all -p timezone/localtime system/timezone:default
timezone/localtime astring manifest UTC
timezone/localtime astring node-profile US/Pacific
$ svccfg -s system/timezone:default listprop -l all -o propname,layer,value \
> timezone/localtime
localtime          node-profile   US/Pacific
localtime          manifest       UTC

Use either the -f option or the -o file option of the svccfg listprop command to show the name of the file that contributed the configuration:

$ svccfg -s system/timezone:default listprop -l all -f timezone/localtime
localtime          /etc/svc/profile/node/migrated_etc_svc_profile_site_sc_profile.xml US/Pacific
localtime          /lib/svc/manifest/system/timezone.xml UTC
$ svccfg -s system/timezone:default listprop -l all -o propname,value,file \
> timezone/localtime
localtime          US/Pacific /etc/svc/profile/node/migrated_etc_svc_profile_site_sc_profile.xml
localtime          UTC /lib/svc/manifest/system/timezone.xml

Showing Values in a Specified Snapshot

The following command lists the snapshots that are available for this service instance. Use these snapshot names with either svcprop or svccfg to show the values of properties that were set in that snapshot. Only instances have snapshots. Services do not have snapshots. See Repository Snapshots for information about snapshots of the service configuration repository.

$ svccfg -s pkg/server:default listsnap
initial
previous
running
start
$ svccfg -s pkg/server:s11 listsnap
previous
running
start

The following commands show that the value of the pkg/inst_root property was different in the previous snapshot.

$ svcprop -s previous -p pkg/inst_root pkg/server:s11
/var/share/pkg/repositories/solaris
$ svccfg -s pkg/server:s11
svc:/application/pkg/server:s11> selectsnap previous
[previous]svc:/application/pkg/server:s11> listprop pkg/inst_root
pkg/inst_root astring     /var/share/pkg/repositories/solaris
[previous]svc:/application/pkg/server:s11> exit

Showing Configuration Customizations

The svccfg listcust command displays customizations at the admin layer for the specified service. Use the -L option to also show customizations in the enterprise-profile, site-profile, node-profile, and sysconfig-profile layers.

The following command shows all customizations at the admin layer of the pkg/server:solaris service:

$ svccfg -s pkg/server:solaris listcust
general                           framework   admin
general/complete                  astring     admin
general/enabled                   boolean     admin                 true
pkg                               application admin
pkg/inst_root                     astring     admin                 /var/share/pkgrepos/solaris
pkg/port                          count       admin                 83
pkg/readonly                      boolean     admin                 true
pkg/standalone                    boolean     admin                 false

The following command shows that the definition of the property config/nodename is provided at the manifest layer, but the value solaris is set at the node-profile layer.

$ svccfg -s identity:node listprop -l all -o propname,layer,value config/nodename
nodename        node-profile   solaris
nodename        manifest

The following command shows only admin layer customizations of the identity:node service:

$ svccfg -s identity:node listcust
config/loopback   astring     admin                 solaris

The following command shows all customizations of the identity:node service:

$ svccfg -s identity:node listcust -L
config            application node-profile
config/loopback   astring     admin                 solaris
config/nodename   astring     node-profile          solaris
general           framework   node-profile
general/enabled   boolean     node-profile          true

The svccfg listcust command also displays all masked entities. Use the -M option to list only masked entities. Before you use the svccfg delcust command, use the svccfg listcust command to verify what will be deleted. See Deleting Property Groups, Properties, and Property Values and the smf(7) man page for a description of masked entities.