Managing System Services in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Adding Property Groups, Properties, and Property Values

The following commands add properties and property groups:

svccfg setprop
svccfg addpropvalue

Adds the property whose value is being set if the property does not already exist.

svccfg addpg

Adds a new property group to a service or service instance.

Remember to use the svccfg refresh command or svcadm refresh command to commit configuration changes into the running snapshot.

Example 4-6  Using addpg to Create a New Property Group

Use the addpg subcommand to add a property group to the selected service or service instance.

svccfg -s FMRI addpg name type [flags]
type

By convention, the value of type is usually application. See Chapter 5, Using SMF to Control Your Application for more information about property group types.

flags

Specify P for the value of flags to store the property group and any added properties as non-persistent. If P is specified, this property group and contained properties will be automatically removed on reboot, The value P is an alias for SCF_PG_FLAG_NONPERSISTENT. See the scf_service_add_pg(3SCF) man page.

$ svccfg -s svc:/site/my-svc addpg config application
$ svccfg -s my-svc listprop config
config  application
$ svccfg -s my-svc:default listprop config
$

In this example, the administrator added the config property group to the parent service, my-svc, but not to the instance, my-svc:default. The listprop command shows that the config property group does not exist in the service instance.

Example 4-7  Using setprop to Create a New Property

Use the setprop subcommand to set a property value as described in Setting Property Values. If the property group does not already exist in the selected instance or service, the property group is created if the type and flags are found in the template definitions. If the property does not already exist in the selected instance or service, you must specify the property type.

$ svccfg -s my-svc:default setprop config/vendor = astring: vendora
$ svccfg -s my-svc:default listprop config/vendor
config/vendor astring     vendora
Example 4-8  Using addpropvalue to Create a New Property

Use the addpropvalue subcommand to add a property value as described in Setting Property Values. If the property group does not already exist in the selected instance or service, the property group is created if the type and flags are found in the template definitions. If the property does not already exist in the selected instance or service, you must specify the property type.

$ svccfg -s my-svc:default addpropvalue config/vendor astring: vendorb
$ -s my-svc:default addpropvalue config/customer astring: acustomer
$ svccfg -s my-svc:default listprop config
config           application        
config/vendor   astring     "vendora" "vendorb"
config/customer astring     acustomer