svcadm(1M)을 검색하려면 섹션에서 1M 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
svcprop(1)
svcprop(1) User Commands svcprop(1)
NAME
svcprop - retrieve values of service configuration properties
SYNOPSIS
svcprop [-afqtv] [-C | -c | -s snapshot] [-p [name/]name]...
[ -g pgtype]... -l layer[,...] {FMRI | pattern}...
svcprop [-afqtv] [-C | -c |-s snapshot] [-G name [-G name]... [-P name]]
[-g pgtype]... -l layer[,...]
{FMRI | pattern}...
svcprop -w [-fqtv] [-p [name/]name] {FMRI | pattern}
svcprop -w [-fqtv] [-G name [-G name]... [-P name]]
{FMRI | pattern}
DESCRIPTION
The svcprop utility prints values of properties in the service configu‐
ration repository. Properties are selected by -p options and the oper‐
ands. The template property group types can be any one of the follow‐
ing; template, template_pg_pattern, and template_prop_pattern.
The default behavior of svcprop without the -C, -c, or -s options is to
access effective properties.
The effective properties of a service consists of all the properties
that are set on the service.
The effective properties of a service instance includes properties in
the composed view of its running snapshot(see smf(7) for an explanation
of property composition and snapshot states). A composed view of all
the properties in the non-persistent property groups of the service
instance are also included in the effective properties despite them not
being part of the running snapshot. If the running snapshot does not
exist then the instance's directly attached properties are used
instead. A directly attached property is an uncommitted property whch
has been set on the instance or on the parent service but the instance
has not been refreshed.
If the FMRI specifies a property, composition is not used to determine
the effective property as it is fully specified by the FMRI.
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, '"', sin‐
gle-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.
OPTIONS
The following options are supported:
-a
Display all properties, including those in SMF template definition
property groups.
-C
Uses the directly attached properties, without composition.
-c
For service instances, uses the composed view of their directly
attached properties.
-f
Selects the multi-property output format, with full FMRIs as desig‐
nators.
-G pg [-G pg ...]
For each service or service instance specified by the operands,
selects all properties in the pg property group. If used with the
-goption, selects the pg property for all matching property group
types. The pg specified may not be a pattern. When multiple -G
options appear then the options indicate how to traverse the prop‐
erty group hierarchy.
-G pg [-G pg ...] -P prop
Selects property prop in property group pg for each of the services
or service instances specified by the operands. Neither the pg nor
the prop specified may be a pattern. When multiple -G options
appear, then the options indicate how to traverse the property
group hierarchy.
-g pgtype
Display only properties that belong 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. Avail‐
able layers are manifest, system-profile, enterprise-profile, site-
profile, node-profile, sysconfig-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. The property group name, and the property name when
specified, must be encoded if a reserved character is used. For
more information, see the smf(7) man page.
-p pg/prop
Selects property prop in property group pg for each of the services
or service instances specified by 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.
-q
Quiet. Produces no output.
-s name
Uses the composed view of the name snapshot for service instances.
-t
Selects the multi-property output format.
-v
Verbose. Prints error messages for non-existent properties, even if
option -q is also used.
-w
Waits until the specified property group or the property group con‐
taining 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.
OPERANDS
The following operands are supported:
FMRI
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. Proper‐
ties and property groups must be specified by a full FMRI. For
example, given the FMRI:
svc:/network/smtp:sendmail
The following are valid abbreviations:
sendmail
:sendmail
smtp
smtp:sendmail
network/smtp
The following are invalid abbreviations:
mailnetwork
network/smt
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.
pattern
A glob pattern which is matched against the FMRIs of services and
instances in the repository. See fnmatch(7). If a pattern exactly
matches a service name, svcprop acts on that service. If the pat‐
tern matches multiple services or instances, svcprop acts on each
service or instance.
EXAMPLES
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
online
Example 2 Determine if a Service is Enabled
Inspect the general/enabled property to determine if the service is
enabled. This property takes immediate effect, so the -c option must be
used as some properties may be inherited:
example% svcprop -c -p general/enabled system/cron:default
true
See smf(7) for a description of composition.
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/enabled boolean true
general/action_authorization astring solaris.smf.manage.ntp
general/entity_stability astring Uncommitted
general/single_instance boolean true
general/value_authorization astring solaris.smf.value.ntp
Example 4 Testing the Existence of a Property
The following example tests the existence of the general/enabled prop‐
erty for all instances of service identity:
example% svcprop -q -p general/enabled identity:
example% echo $?
0
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`
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
...
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):
fmri=$1
prop=$2
if svcprop -q -p ${prop} ${fmri} ; then
propval="$(svcprop -p ${prop} "${fmri}")"
if [[ "${propval}" == "\"\"" ]] ; then
propval=""
fi
fi
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 cus‐
tomized properties.
example% svcprop -p config -l admin svc:/network/dns/client
config/domain astring admin my.domain.com
config/nameserver net_address admin 10.22.33.44 10.44.33.11
Example 10 Displaying the Value of a Single Property with Reserved
Characters
The following example displays the value of the current state property
in the config property group of instance inst of service svc.
example% svcprop -p config/current%20state svc:inst
starting
If specifying the property name unambiguously. then the same command
may be written without the encoding by using the -G and -P options:
example% svcprop -G config -P "current state" svc:inst
starting
Example 11 Displaying All Properties in a Nested Property Group
For a service named demo with a property group named pgb that is nested
within a property group named pga, the following example would display
all properties in the pgb property group in the default instance.
example% svcprop -p pga/pgb demo
pga/pgb/property astring 123
If specifying the property group name unambiguously then the same com‐
mand may be written by using the -G options:
example% svcprop -G pga -G pgb demo
pga/pgb/property astring 123
EXIT STATUS
The following exit values are returned:
0
Successful completion.
1
An error occurred.
2
Invalid command line options were specified.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/core-os
SEE ALSO
svcs(1), service_bundle(5), attributes(7), fnmatch(7), smf(7),
smf_method(7), smf_security(7), inetd(8), svc.startd(8), svcadm(8),
svccfg(8)
Oracle Solaris 11.4 21 May 2021 svcprop(1)