SVCCFG(8) | Maintenance Commands and Procedures | SVCCFG(8) |
svccfg
— import,
export, and modify service configurations
svccfg |
[-v ] [-z
zone] [-s
FMRI] |
svccfg |
[-v ] [-z
zone] [-s
FMRI] subcommand
[args...] |
svccfg |
[-v ] [-z
zone] [-s
FMRI] -f
command-file |
The svccfg
command manipulates data in the
service configuration repository. svccfg
can be
invoked interactively, with an individual subcommand, or by specifying a
command file that contains a series of subcommands.
Changes made to an existing service in the repository typically do not take effect for that service until the next time the service instance is refreshed. See the refresh subcommand on the svcadm(8) man page for more details.
The following options are supported:
-f
filesvccfg
subcommands from
file.-s
FMRI-v
-z
zoneSubcommands are divided into the categories specified in the subsections that follow.
All subcommands that accept FMRIs also accept abbreviated or globbed patterns. Instances and services can be abbreviated by specifying the instance name, or the trailing portion of the service name. For example, given the FMRI:
All the following are valid abbreviations:
While the following are invalid:
Abbreviated forms of FMRIs are unstable, and should not be used in scripts or other permanent tools. If a pattern matches more than one instance or service, an error message is printed and no action is taken.
end
,
exit
, quit
repository
repfilesvccfg
uses the system repository.
Use repository only with files from the identical version of illumos, including updates, that you are currently running. Do not use this subcommand with the system repository, /etc/svc/repository.db.
set
[-v
| -V
]apply
[-n
] file-n
is specified, the profile is processed and
no changes are applied to the SMF repository. Any syntax error found will
be reported on stderr
and an exit code of
1 will be returned. See
smf(7) for a description of service
profiles. This command requires privileges to modify properties in the
service and instance. See
smf_security(7) for the
privileges required to modify properties. If file is
not a service profile, the subcommand fails.extract
[> file]archive
[-a
]Without the -a
option, property groups
containing protected information (identified by the presence of the
read_authorization property — see
smf_security(7)) will be
archived without their property values. When the
-a
option is specified, all values will be
archived. An error results if there are insufficient privileges to read
these values.
export
[-a
] service_FMRI [>
file]Without the -a
option, property groups
containing protected information (identified by the presence of the
read_authorization property — see
smf_security(7)) will be
exported without their property values. When the
-a
option is specified, all values will be
archived. An error results if there are insufficient privileges to read
these values.
Note that export
requires a service
FMRI. To ease the use of arguments cut and pasted from other command
output, if you specify a complete instance FMRI, the entire
corresponding service including all instances is exported and a warning
is issued. If you specify an abbreviation, such as
‘apache2’ or ‘sendmail’, that specifies an
instance, the command fails.
import
[-V
] fileServices and instances in the manifest will be validated
against template data in the manifest and the repository, and warnings
will be issued for all template violations. See
smf_template(7) for a
description of templates. If the -V
option is
specified, manifests that violate the defined templates will fail to
import. In interactive invocations of svccfg
,
-V
is the default behavior.
For existing services and instances, properties which have not
changed since the last import snapshot was taken are upgraded to those
specified by the manifest. Conflicts (properties which have been changed
both in the repository and the manifest) are reported on the standard
error stream. svccfg
will never upgrade the
“general/enabled” and “general/restarter”
properties, since they represent administrator preference.
inventory
filerestore
archive
subcommand. If the archive was generated without the use of the
-a
option, the contents of the repository
following completion of the restore will not include the values of any
read-protected properties (see
smf_security(7)). If these are
required, they must be restored manually.
Restoring an archive which is inconsistent with currently installed software (including patch revisions) might yield unpredictable results. Therefore, prior to restoring an archive, all system and application software, including any service manifests, should be restored to the same state it was in at the time the archive was made.
validate
[file | fmri]validate
subcommand can operate on a manifest
file, an instance FMRI, or the current instance or snapshot entity
selection. When an argument is specified, svccfg
will check to see whether the specified file exists. If the file exists,
it will be validated. If a file of the specified name does not exist, the
argument is treated as an FMRI pattern. If a conflict arises between a
filename and an FMRI, use the svc: and file: prefixes to tell
svccfg
how to interpret the argument.
When you specify a file, the file is processed in a manner
similar to import
-V
,
but no changes are made to the repository. If any errors are detected,
svccfg
displays the errors and exits with a
nonzero exit status.
For an instance fmri, instance entity selection, or snapshot entity selection, the specified instance in its composed form (see “Properties and Property Groups” in smf(7)) will be validated against template data in the repository. Instance FMRIs and instance entity selections use the “running” snapshot for validation. Warnings will be issued for all template violations. See smf_template(7) for a description of templates.
An “entity” refers to a scope, service, or service instance.
add
namedelete
[-f
] {name |
fmri}-f
flag is specified. If a
service or service instance has a “dependents” property
group of type “framework”, then for each of its properties
with type “astring” or “fmri”, if the property
has a single value which names a service or service instance then the
dependency property group in the indicated service or service instance
with the same name as the property will be deleted. See
smf_security(7) for the
privileges required to delete service configurations.list
[pattern]select
{name | fmri}unselect
addpg
name type
[flags]SCF_PG_FLAG_NONPERSISTENT
(see
scf_service_add_pg(3SCF)).
See smf_security(7) for the
privileges required to create property groups.addpropvalue
pg/name
[type:]
valuedelpg
namedelprop
pg[/name]delpropvalue
pg/name globpatterndescribe
[-v
] [-t
]
[propertygroup/property]When invoked without arguments,
describe
gives basic descriptions (if available)
of the currently selected entity and all of its currently set property
groups and properties. A property group or specific property can be
queried by specifying either the property group name, or the property
group name and property name, separated by a slash (‘/’),
as an argument.
The -v
option gives all information
available, including descriptions for current settings, constraints, and
other possible setting choices.
The -t
option shows only the template
data for the selection (see
smf_template(7)), and does
not display the current settings for property groups and properties.
editprop
EDITOR
environment variable is invoked to edit
it. Upon completion, the commands in the temporary file are executed. The
default editor is vi(1). See
smf_security(7) for the
privileges required to create, modify, or delete properties.listpg
[pattern]In interactive mode, a basic description of the property groups is also given.
listprop
[pattern]setenv
[-i
| -s
]
[-m
method_name]
envvar value-i
option is used, the
“method_context” property group is used, if an instance is
currently selected. If the -s
option is used and a
service is currently selected, its “method_context” property
group is used. If the -s
option is used and an
instance is currently selected, the “method_context”
property group of its parent is used. If neither the
-i
option nor the -s
option is used, the “start” property group is searched for
in the currently selected entity and, if an instance is currently
selected, its parent is also searched. If the “inetd_start”
property group is not located, it is searched for in a similar manner.
Once the property is located, all values which begin with envvar followed by a “=” are removed, and the value “envvar=value” is added. See smf_security(7) for the privileges required to modify properties.
setprop
pg/name =
[type:]
valuesetprop
pg/name =
[type:]
(values ...
)unsetenv
[-i
| -s
]
[-m
method_name]
envvar value-i
option is used, the
“method_context” property group is used, if an instance is
currently selected. If the -s
option is used and a
service is currently selected, its “method_context” property
group is used. If the -s
option is used and an
instance is currently selected, the “method_context”
property group of its parent is used. If neither the
-i
option nor the -s
option is used, the “start” property group is searched for
in the currently selected entity and, if an instance is currently
selected, its parent is also searched. If the “inetd_start”
property group is not located, it is searched for in a similar manner.
Once the property is located, all values which begin with envvar followed by “=” are removed. See smf_security(7) for the privileges required to modify properties.
listsnap
revert
[snapshot]refresh
subcommand of svcadm(8). See
smf_security(7) for the
privileges required to change properties.selectsnap
[name]refresh
The following exit values are returned:
Example 1 Importing a Service Description
The following example imports a service description for the seismic service in the XML manifest specified on the command line.
# svccfg import
/var/svc/manifest/site/seismic.xml
Note that the manifest must follow the format specified in service_bundle(5).
Example 2 Exporting a Service Description
To export a service description on the local system:
# svccfg export dumpadm
>/tmp/dump.xml
Example 3 Deleting a Service Instance
To delete a service instance:
# svccfg delete
network/inetd-upgrade:default
Example 4 - Checking Properties in an Alternate Repository
To examine the state of a service's properties after loading an alternate repository, use the sequence of commands shown below. One might use such commands, for example, to determine whether a service was enabled in a particular repository backup.
# svccfg svc:> repository /etc/svc/repository-boot svc:> select telnet:default svc:/network/telnet:default> listprop general/enabled general/enabled boolean false svc:/network/telnet:default> exit
Example 5 Enabling Debugging
To modify LD_PRELOAD
for a start method
and enable the use of
libumem(3LIB) with debugging
features active:
$ svccfg -s system/service setenv LD_PRELOAD libumem.so $ svccfg -s system/service setenv UMEM_DEBUG default
Example 6 Using the
describe
Subcommand
The following command illustrates the use of the
describe
subcommand.
# svccfg -s console-login describe ttymon ttymon application ttymon/device astring /dev/console terminal device to be used for the console login prompt ttymon/label astring console appropriate entry from /etc/ttydefs ...
The interactive output of svccfg
is
Not-An-Interface
and may change at any time.
The command line interface and non-interactive
output of svccfg
is
Committed.
svcprop(1), svcs(1), libscf(3LIB), libumem(3LIB), scf_service_add_pg(3SCF), scf_value_create(3SCF), contract(5), service_bundle(5), attributes(7), fnmatch(7), smf(7), smf_method(7), smf_security(7), smf_template(7), zones(7), svc.configd(8), svcadm(8)
June 1, 2023 | OmniOS |