Go to main content

Managing System Services in Oracle® Solaris 11.4

Exit Print View

Updated: Febuary 2019

Using the Service Configuration Command

The svccfg command manipulates data in the service configuration repository. Changes made with the svccfg command are recorded in the admin layer. See Repository Layers for information about layers. Changes made with the svccfg command are stored in the service configuration repository as current, or editing, property values, and do not immediately appear in the running snapshot. When you change configuration data, use the svcadm refresh or svccfg refresh command to commit the new values into the running snapshot.

Keeping newly changed data separate from the running snapshot enables you to make multiple changes, and then commit all the changes to the running snapshot together. While you are in the process of making multiple changes, some property values might be incompatible or inconsistent, but the running snapshot is unmodified. When you are finished making changes, perform a refresh.

You can use the svccfg command in any of the following ways:

  • Use the svccfg editprop command to invoke an editor on the property groups and properties of the currently selected entity.

  • Enter a full svccfg command on the command line, specifying subcommands such as setprop.

  • Enter only svccfg or svccfg -s FMRI on the command line to start an interactive session.

  • Specify the -f option to read svccfg commands from a file.

Invoking a Property Editor

Invoking the svccfg command as shown in the following example opens an editor on the properties of the selected entity. This form of the svccfg command can be very fast and convenient for modifying several property values. For the editprop subcommand, you must specify an entity with the -s option.

$ svccfg -s pkg/server:s11 editprop

A file of setprop commands for the current values of each property of the specified entity opens in the editor specified by the VISUAL environment variable. If VISUAL is not defined, the editor specified by EDITOR is opened. If neither VISUAL nor EDITOR is defined, the property file is opened in vi.

Each line of the file is preceded by a comment character. To change the value of a property in the svccfg editing configuration, remove the comment character, change the value, and save the file. To change the value of a property in the running snapshot, remove the comment character from the last line of the file, which is the refresh subcommand.

The following listing shows a partial example of a file created by the editprop subcommand:

## Change property values by removing the leading '#' from the
## appropriate lines and editing the values. svccfg subcommands
## such as delprop can also be added to the script.
## Property group "pkg"
## The following properties are defined in the selected instance
## (svc:/application/pkg/server:s11)

# setprop pkg/port = count: 81
# setprop pkg/inst_root = astring: /export/ipsrepos/Solaris11

## The following properties inherit from the parent service
## (svc:/application/pkg/server)

# ...

## Property group "pkg_bui"

# ...

## Property group "pkg_secure"

# ...

## Uncomment to apply these changes to this instance.
# refresh

As the instructions in the file state, you can add subcommands other than setprop. For example, you could add a delprop command. Some property groups, such as framework and dependency, are not displayed by default. Specify editprop -a to show all properties.

The uncommented commands in this temporary file are executed when you save and quit the editing session.

Invoking svccfg Interactively or With a File

Invoking the svccfg command interactively as shown in the following example can be convenient when you want to perform several configuration operations.

$ svccfg
svc:> select pkg/server
svc:/application/pkg/server> list
svc:/application/pkg/server> add s11
svc:/application/pkg/server> select s11
svc:/application/pkg/server:s11> setprop pkg/inst_root=/export/ipsrepos/Solaris11
svc:/application/pkg/server:s11> setprop pkg/port=81
svc:/application/pkg/server:s11> unselect
svc:/application/pkg/server> add oss
svc:/application/pkg/server> select oss
svc:/application/pkg/server:oss> setprop pkg/inst_root=/export/ipsrepos/SolarisStudio
svc:/application/pkg/server:oss> setprop pkg/port=82
svc:/application/pkg/server:oss> unselect
svc:/application/pkg/server> list
svc:/application/pkg/server> refresh
svc:/application/pkg/server> select pkg/mirror:default
svc:/application/pkg/mirror:default> listprop config/crontab_period
config/crontab_period astring     "30 2 25 * *"
svc:/application/pkg/mirror:default> setprop config/crontab_period="00 3 25 * *"
svc:/application/pkg/mirror:default> refresh
svc:/application/pkg/mirror:default> exit

The same commands given at the interactive prompts in the preceding example could also be provided in a file and executed with a command such as the following command.

$ svccfg -f cfgpkgrepos