The following commands add properties and property groups:
Adds the property whose value is being set if the property does not already exist.
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 33 Using addpg to Create a New Property GroupUse the addpg subcommand to add a property group to the selected service or service instance.
svccfg -s FMRI addpg name type [flags]
By convention, the value of type is usually application. See Developing System Services in Oracle Solaris 11.4 for more information about property group types.
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.
The following example adds a nested property group. Nested property groups must all be the same type.
$ svccfg -s my-svc addpg config/security application $ svccfg -s my-svc listprop config config application config/security application
The following example adds a property group whose name includes a reserved character:
$ svccfg -s my-svc addpg -G config -G security -G certs+keys application $ svccfg -s my-svc listprop config config application config/security application config/security/certs%2Bkeys applicationExample 34 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/source = uri: http://example1.com/ $ svccfg -s my-svc:default listprop config/source config/source uri http://example1.com/
To add a new property that has the same name as a property group, use the -G and -P options:
$ svccfg -s my-svc setprop -G config -P security -T astring yes $ svccfg -s my-svc listprop config/security config/security astring yes config/security application config/security/certs%2Bkeys application
The following example adds a property whose name includes a reserved character. Use the -T option to specify the type of the new property.
$ svccfg -s my-svc setprop -G config -P "maximum %" -T integer 100 $ svccfg -s my-svc listprop -G config -P "maximum %" config/maximum%20%25 integer 100Example 35 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/source http://example2.com/ $ svccfg -s my-svc:default addpropvalue config/target hostname: example3 $ svccfg -s my-svc:default listprop config config application config/source uri http://example1.com/ http://example2.com/ config/target hostname example3