Unix‎ > ‎Solaris‎ > ‎Solaris man pages‎ > ‎1‎ > ‎

svcprop


NAME
     svcprop - retrieve values of service  configuration  proper-
     ties

SYNOPSIS
     svcprop [-fqtv] [-C | -c | -s snapshot] [-p [name/]name]...
         {FMRI | pattern}...


     svcprop -w [-fqtv] [-p [name/]name] {FMRI | pattern}


DESCRIPTION
     The svcprop utility prints values of properties in the  ser-
     vice configuration repository. Properties are selected by -p
     options and the operands.

     Without the -C, -c, or -s options, svcprop  accesses  effec-
     tive  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
     nonpersistent  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 proper-
     ties 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 (';', '&', 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.

     Error messages are printed to the standard error stream.

OPTIONS
     The following options are supported:

     -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 designators.


     -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.


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


     -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 nonexistent
                   properties, even if option -q is also used.


     -w            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  given.  If more than one operand is given,
                   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 pro-
                perty 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  pro-
                perty  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:

                  mail
                  network
                  network/smt


                Abbreviated  forms  of  FMRIs  are  unstable  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(5). If a pattern  matches  multiple  ser-
                vices  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  pro-
     perty in the restarter property group of instance default of
     service system/cron.


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



     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
       true



     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 Unstable
       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 iden-
     tity:


       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  pro-
     perty 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

       example% cat getval
       #!/bin/sh

       svcprop -p $1 $2 | (
               read value v2
               if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi
               echo $value
             )



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(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWcsu                     |
    |_____________________________|_____________________________|


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)










Man pages from Solaris 10 Update 8. See docs.sun.com and www.oracle.com for further documentation and Solaris information.
Comments