'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved .\" Copyright 2012, Joyent, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH SVCCFG 1M "Jun 29, 2009" .SH NAME svccfg \- import, export, and modify service configurations .SH SYNOPSIS .LP .nf \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR] .fi .LP .nf \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR] \fIsubcommand\fR [\fBargs\fR]... .fi .LP .nf \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR] \fB-f\fR \fIcommand-file\fR .fi .SH DESCRIPTION .LP The \fBsvccfg\fR command manipulates data in the service configuration repository. \fBsvccfg\fR can be invoked interactively, with an individual subcommand, or by specifying a command file that contains a series of subcommands. .sp .LP 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 \fBrefresh\fR subcommand on the \fBsvcadm\fR(1M) man page for more details. .SH OPTIONS .LP The following options are supported: .sp .ne 2 .na \fB\fB-f\fR \fIcommand-file\fR\fR .ad .sp .6 .RS 4n Reads and executes \fBsvccfg\fR subcommands from \fIcommand-file\fR. .RE .sp .ne 2 .na \fB\fB-s\fR \fIFMRI\fR\fR .ad .sp .6 .RS 4n Selects the entity indicated by \fIFMRI\fR (a fault management resource identifier) before executing any subcommands. See \fBsmf\fR(5). .RE .sp .ne 2 .na \fB\fB-v\fR\fR .ad .sp .6 .RS 4n Verbose. .RE .SH SUBCOMMANDS .LP Subcommands are divided into the categories specified in the subsections that follow. .sp .LP All subcommands that accept \fIFMRI\fRs 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 \fIFMRI\fR: .sp .in +2 .nf svc:/network/smtp:sendmail .fi .in -2 .sp .sp .LP All the following are valid abbreviations: .sp .in +2 .nf sendmail :sendmail smtp smtp:sendmail network/smtp .fi .in -2 .sp .sp .LP While the following are invalid: .sp .in +2 .nf mail network network/smt .fi .in -2 .sp .sp .LP Abbreviated forms of \fIFMRI\fRs 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. .SS "General Subcommands" .ne 2 .na \fB\fBend\fR\fR .ad .br .na \fB\fBexit\fR\fR .ad .br .na \fB\fBquit\fR\fR .ad .sp .6 .RS 4n Exits immediately. .RE .sp .ne 2 .na \fB\fBrepository\fR \fIrepfile\fR\fR .ad .sp .6 .RS 4n Uses \fIrepfile\fR as a repository. By default, \fBsvccfg\fR(1M) uses the system repository. .sp Use repository only with files from the identical version of Solaris, including patches, that you are currently running. Do not use this subcommand with the system repository, \fB/etc/svc/repository.db\fR. .RE .sp .ne 2 .na \fB\fBset\fR [\fB-v\fR|\fB-V\fR]\fR .ad .sp .6 .RS 4n Sets optional behavior. If no options are specified, set displays the options currently in effect. .sp .ne 2 .na \fB\fB-v\fR\fR .ad .sp .6 .RS 4n Turns on verbose mode. .RE .sp .ne 2 .na \fB\fB-V\fR\fR .ad .sp .6 .RS 4n Turns off verbose mode. .RE .RE .SS "Service Profile Subcommands" .ne 2 .na \fB\fBapply\fR [\fB-n\fR] \fIfile\fR\fR .ad .sp .6 .RS 4n If a \fIfile\fR is a service profile, properties, including general/enabled, that are specified in the file are modified in the SMF repository. Not-yet-existent properties and property groups will be created. The type of the pre-existing property \fBgroups\fR will not be changed by the profile. Existing properties (as distinguished from property groups) \fBcan\fR have their type changed by the profile. Nonexistent services and instances are ignored. Services and instances modified by the profile will be refreshed. If \fB-n\fR 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 \fB1\fR will be returned. See \fBsmf\fR(5) for a description of service profiles. This command requires privileges to modify properties in the service and instance. See \fBsmf_security\fR(5) for the privileges required to modify properties. If \fIfile\fR is not a service profile, the subcommand fails. .RE .sp .ne 2 .na \fB\fBextract\fR [\fI> file\fR]\fR .ad .sp .6 .RS 4n Prints a service profile which represents the enabled status of the service instances in the repository to standard output. The output may be redirected to a file. .RE .SS "Service Manifest Subcommands" .ne 2 .na \fB\fBarchive\fR [\fB-a\fR]\fR .ad .sp .6 .RS 4n Dumps a full \fBXML\fR service description for all services, instances, and their persistent properties in the repository. This does not include transient properties such as service state, and is suitable for a relocatable repository backup. .sp Without the \fB-a\fR option, property groups containing protected information (identified by the presence of the \fBread_authorization\fR property\(emsee \fBsmf_security\fR(5)) will be archived without their property values. When the \fB-a\fR option is specified, all values will be archived. An error results if there are insufficient privileges to read these values. .RE .sp .ne 2 .na \fB\fBexport\fR [\fB-a\fR] \fIservice_FMRI\fR [\fI>file\fR]\fR .ad .sp .6 .RS 4n The service description for the specified service and its instances is written to standard output or redirected to the given file. Dependencies with a boolean "external" property set to true are omitted in the belief that they were created on behalf of another service. .sp Without the \fB-a\fR option, property groups containing protected information (identified by the presence of the \fBread_authorization\fR property\(emsee \fBsmf_security\fR(5)) will be exported without their property values. When the \fB-a\fR option is specified, all values will be archived. An error results if there are insufficient privileges to read these values. .sp Note that \fBexport\fR 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 \fBapache2\fR or \fBsendmail\fR, that specifies an instance, the command fails. .RE .sp .ne 2 .na \fB\fBimport\fR [\fB-V\fR] \fIfile\fR\fR .ad .sp .6 .RS 4n If \fIfile\fR is a service manifest, then the services and instances it specifies are imported into the repository. According to the file, dependencies may be created in other services. See \fBsmf\fR(5) for a description of service manifests. See \fBsmf_security\fR(5) for the privileges required to create and modify service configurations. .sp Services 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 \fBsmf_template\fR(5) for a description of templates. If the \fB-V\fR option is specified, manifests that violate the defined templates will fail to import. In interactive invocations of \fBsvccfg\fR, \fB-V\fR is the default behavior. .sp For existing services and instances, properties which have not changed since the last \fBimport\fR 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. \fBsvccfg\fR will never upgrade the "general/enabled" and "general/restarter" properties, since they represent administrator preference. .RE .sp .ne 2 .na \fB\fBinventory\fR \fIfile\fR\fR .ad .sp .6 .RS 4n If \fIfile\fR is determined to be a service manifest, then the \fBFMRI\fRs of the services and instances the \fIfile\fR describes are printed. For each service, the \fBFMRI\fRs of its instances are displayed before the \fBFMRI\fR of the service. .RE .sp .ne 2 .na \fB\fBrestore\fR\fR .ad .sp .6 .RS 4n Restores the contents of the repository from a full XML service description previously created by the \fBarchive\fR subcommand. If the archive was generated without the use of the \fB-a\fR option, the contents of the repository following completion of the restore will not include the values of any read-protected properties (see \fBsmf_security\fR(5)). If these are required, they must be restored manually. .sp 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. .RE .sp .ne 2 .na \fB\fBvalidate\fR [\fIfile\fR | \fIfmri\fR]\fR .ad .sp .6 .RS 4n The \fBvalidate\fR subcommand can operate on a manifest file, an instance FMRI, or the current instance or snapshot entity selection. When an argument is specified, \fBsvccfg\fR 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 \fBsvc:\fR and \fBfile:\fR prefixes to tell \fBsvccfg\fR how to interpret the argument. .sp When you specify a file, the file is processed in a manner similar to \fBimport\fR \fB-V\fR, but no changes are made to the repository. If any errors are detected, \fBsvccfg\fR displays the errors and exits with a nonzero exit status. .sp For an instance \fIfmri\fR, instance entity selection, or snapshot entity selection, the specified instance in its composed form (see "Properties and Property Groups" in \fBsmf\fR(5)) 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 \fBsmf_template\fR(5) for a description of templates. .RE .SS "Entity Selection, Modification, and Navigation Subcommands" .LP An "entity" refers to a scope, service, or service instance. .sp .ne 2 .na \fB\fBadd\fR \fIname\fR\fR .ad .sp .6 .RS 4n A new entity with the given name is created as a child of the current selection. See \fBsmf_security\fR(5) for the privileges required to create entities. .RE .sp .ne 2 .na \fB\fBdelete\fR [\fB-f\fR] \fB{\fIname\fR | \fIfmri\fR}\fR\fR .ad .sp .6 .RS 4n The named child of the current selection or the entity specified by \fIfmri\fR is deleted. Attempts to delete service instances in the "online" or "degraded" state will fail unless the \fB-f\fR 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 \fBsmf_security\fR(5) for the privileges required to delete service configurations. .RE .sp .ne 2 .na \fB\fBlist\fR [\fIpattern\fR]\fR .ad .sp .6 .RS 4n The child entities of the current selection whose names match the glob pattern \fIpattern\fR are displayed (see \fBfnmatch\fR(5)). \&':properties' is also listed for property-bearing entities, namely services and service instances. .RE .sp .ne 2 .na \fB\fBselect\fR {\fIname\fR | \fIfmri\fR}\fR .ad .sp .6 .RS 4n If the argument names a child of the current selection, it becomes the current selection. Otherwise, the argument is interpreted as an \fBFMRI\fR and the entity that the argument specifies becomes the current selection. .RE .sp .ne 2 .na \fB\fBunselect\fR\fR .ad .sp .6 .RS 4n The parent of the current selection becomes the current selection. .RE .SS "Property Inspection and Modification Subcommands" .ne 2 .na \fB\fBaddpg\fR \fIname\fR \fItype\fR [\fIflags\fR]\fR .ad .sp .6 .RS 4n Adds a property group with the given \fIname\fR and type to the current selection. \fIflags\fR is a string of characters which designates the flags with which to create the property group. 'P' represents \fBSCF_PG_FLAG_NONPERSISTENT\fR (see \fBscf_service_add_pg\fR(3SCF)). See \fBsmf_security\fR(5) for the privileges required to create property groups. .RE .sp .ne 2 .na \fB\fBaddpropvalue\fR \fIpg\fR\fI/name\fR [\fItype:\fR] \fIvalue\fR\fR .ad .sp .6 .RS 4n Adds the given value to a property. If \fItype\fR is given and the property exists, then if \fItype\fR does not agree with the property's \fItype\fR, the subcommand fails. The values may be enclosed in double-quotes. String values containing double-quotes or backslashes must be enclosed by double-quotes and the contained double-quotes and backslashes must be quoted by backslashes. Nonexistent properties are created, in which case the \fItype\fR specifier must be present. See \fBscf_value_create\fR(3SCF) for a list of available property types. See \fBsmf_security\fR(5) for the privileges required to modify properties. The new value will be appended to the end of the list of property values associated with the property. .RE .sp .ne 2 .na \fB\fBdelpg\fR \fIname\fR\fR .ad .sp .6 .RS 4n Deletes the property group \fIname\fR of the current selection. See \fBsmf_security\fR(5) for the privileges required to delete property groups. .RE .sp .ne 2 .na \fB\fBdelprop\fR \fIpg\fR[\fI/name\fR]\fR .ad .sp .6 .RS 4n Deletes the named property group or property of the current selection. See \fBsmf_security\fR(5) for the privileges required to delete properties. .RE .sp .ne 2 .na \fB\fBdelpropvalue\fR \fIpg/name\fR \fIglobpattern\fR\fR .ad .sp .6 .RS 4n Deletes all values matching the given \fIglob\fR pattern in the named property. Succeeds even if no values match. See \fBsmf_security\fR(5) for the privileges required to modify properties. .RE .sp .ne 2 .na \fB\fBdescribe\fR [\fB-v\fR] [\fB-t\fR] [\fIpropertygroup\fR/\fIproperty\fR]\fR .ad .sp .6 .RS 4n Describes either the current or the possible settings. .sp When invoked without arguments, \fBdescribe\fR 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 (\fB/\fR), as an argument. .sp The \fB-v\fR option gives all information available, including descriptions for current settings, constraints, and other possible setting choices. .sp The \fB-t\fR option shows only the template data for the selection (see \fBsmf_template\fR(5)), and does not display the current settings for property groups and properties. .RE .sp .ne 2 .na \fB\fBeditprop\fR\fR .ad .sp .6 .RS 4n Comments of commands to reproduce the property groups and properties of the current selection are placed in a temporary file and the program named by the \fBEDITOR\fR environment variable is invoked to edit it. Upon completion, the commands in the temporary file are executed. The default editor is \fBvi\fR(1). See \fBsmf_security\fR(5) for the privileges required to create, modify, or delete properties. .RE .sp .ne 2 .na \fB\fBlistpg\fR [\fIpattern\fR]\fR .ad .sp .6 .RS 4n Displays the names, types, and flags of property groups of the current selection. If an argument is given, it is taken as a glob pattern and only property groups with names which match the argument are listed. .sp In interactive mode, a basic description of the property groups is also given. .RE .sp .ne 2 .na \fB\fBlistprop\fR [\fIpattern\fR]\fR .ad .sp .6 .RS 4n Lists property groups and properties of the current selection. For property groups, names, types, and flags are listed. For properties, names (prepended by the property group name and a slash (/)), types, and values are listed. See \fBscf_value_create\fR(3SCF) for a list of available property types. If an argument is supplied it is taken as a glob pattern and only property groups and properties with names which match the argument are listed. .RE .sp .ne 2 .na \fB\fBsetenv\fR [\fB-i\fR | \fB-s\fR] [\fB-m\fR \fImethod_name\fR] \fIenvvar value\fR\fR .ad .sp .6 .RS 4n Sets a method environment variable for a service or instance by changing the "environment" property in the \fImethod_name\fR property group, if that property group has type "method". If \fImethod_name\fR is not specified and the \fB-i\fR option is used, the "method_context" property group is used, if an instance is currently selected. If the \fB-s\fR option is used and a service is currently selected, its "method_context" property group is used. If the \fB-s\fR option is used and an instance is currently selected, the "method_context" property group of its parent is used. If neither the \fB-i\fR option nor the \fB-s\fR 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 similiar manner. .sp Once the property is located, all values which begin with \fIenvvar\fR followed by a "=" are removed, and the value "\fIenvvar\fR=\fIvalue\fR" is added. See \fBsmf_security\fR(5) for the privileges required to modify properties. .RE .sp .ne 2 .na \fB\fBsetprop\fR \fIpg/name\fR = [\fItype:\fR] \fIvalue\fR\fR .ad .br .na \fBsetprop \fIpg/name\fR = [\fItype:\fR] ([\fIvalues ...\fR])\fR .ad .sp .6 .RS 4n Sets the \fIname\fR property of the \fIpg\fR property group of the current selection to the given values of type \fItype\fR. See \fBscf_value_create\fR(3SCF) for a list of available property types. If the property already exists and the \fItype\fR disagrees with the existing \fItype\fR on the property, the subcommand fails. Values may be enclosed in double-quotes. String values which contain double-quotes or backslashes must be enclosed by double-quotes and the contained double-quotes and backslashes must be quoted by backslashes. If the named property does not exist, it is created, as long as the type is specified. See \fBsmf_security\fR(5) for the privileges required to create or modify properties. Multiple values will be stored in the order in which they are specified. .RE .sp .ne 2 .na \fB\fBunsetenv\fR [\fB-i\fR | \fB-s\fR] [\fB-m\fR \fImethod_name\fR] \fIenvvar value\fR\fR .ad .sp .6 .RS 4n Removes a method environment variable for a service or instance by changing the "environment" property in the \fImethod_name\fR property group, if that property group has type "method". If \fImethod_name\fR is not specified and the \fB-i\fR option is used, the "method_context" property group is used, if an instance is currently selected. If the \fB-s\fR option is used and a service is currently selected, its "method_context" property group is used. If the \fB-s\fR option is used and an instance is currently selected, the "method_context" property group of its parent is used. If neither the \fB-i\fR option nor the \fB-s\fR 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 similiar manner. .sp Once the property is located, all values which begin with \fIenvvar\fR followed by "=" are removed. See \fBsmf_security\fR(5) for the privileges required to modify properties. .RE .SS "Snapshot Navigation and Selection Subcommands" .ne 2 .na \fB\fBlistsnap\fR\fR .ad .sp .6 .RS 4n Displays snapshots available for the currently selected instance. .RE .sp .ne 2 .na \fB\fBrevert\fR [\fIsnapshot\fR]\fR .ad .sp .6 .RS 4n Reverts the properties of the currently selected instance and its service to those recorded in the named snapshot. If no argument is given, use the currently selected snapshot and deselect it on success. The changed property values can be made active via the \fBrefresh\fR subcommand of \fBsvcadm\fR(1M). See \fBsmf_security\fR(5) for the privileges required to change properties. .RE .sp .ne 2 .na \fB\fBselectsnap\fR [\fIname\fR]\fR .ad .sp .6 .RS 4n Changes the current snapshot to the one named by \fIname\fR. If no \fIname\fR is specified, deselect the currently selected snapshot. Snapshots are read-only. .RE .SS "Instance Subcommands" .ne 2 .na \fB\fBrefresh\fR\fR .ad .sp .6 .RS 4n Commit the values from the current configuration to the running snapshot, making them available for use by the currently selected instance. If the repository subcommand has not been used to select a repository, direct the instance's restarter to reread the updated configuration. .RE .SH EXAMPLES .LP \fBExample 1 \fRImporting a Service Description .sp .LP The following example imports a service description for the \fBseismic\fR service in the XML manifest specified on the command line. .sp .in +2 .nf # \fBsvccfg import /var/svc/manifest/site/seismic.xml\fR .fi .in -2 .sp .sp .LP Note that the manifest must follow the format specified in \fBservice_bundle\fR(4). .LP \fBExample 2 \fRExporting a Service Description .sp .LP To export a service description on the local system: .sp .in +2 .nf # \fBsvccfg export dumpadm >/tmp/dump.xml\fR .fi .in -2 .sp .LP \fBExample 3 \fRDeleting a Service Instance .sp .LP To delete a service instance: .sp .in +2 .nf # \fBsvccfg delete network/inetd-upgrade:default\fR .fi .in -2 .sp .LP \fBExample 4 \fRChecking Properties in an Alternate Repository .sp .LP 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. .sp .in +2 .nf # \fBsvccfg\fR svc:> \fBrepository /etc/svc/repository-boot\fR svc:> \fBselect telnet:default\fR svc:/network/telnet:default> \fBlistprop general/enabled\fR general/enabled boolean false svc:/network/telnet:default> \fBexit\fR .fi .in -2 .sp .LP \fBExample 5 \fREnabling Debugging .sp .LP To modify \fBLD_PRELOAD\fR for a start method and enable the use of \fBlibumem\fR(3LIB) with debugging features active: .sp .in +2 .nf $ \fBsvccfg -s system/service setenv LD_PRELOAD libumem.so\fR $ \fBsvccfg -s system/service setenv UMEM_DEBUG default\fR .fi .in -2 .sp .LP \fBExample 6 \fRUsing \fBdescribe\fR Subcommand .sp .LP The following command illustrates the use of the \fBdescribe\fR subcommand. .sp .in +2 .nf # \fBsvccfg -s console-login describe ttymon\fR ttymon application ttymon/device astring /dev/console \fBterminal device to be used for the console login prompt\fR ttymon/label astring console \fBappropriate entry from /etc/ttydefs\fR ... .fi .in -2 .sp .SH ENVIRONMENTAL VARIABLES .ne 2 .na \fBEDITOR\fR .ad .sp .6 .RS 4n The command to run when the \fBeditprop\fR subcommand is used. The default editor is \fBvi\fR(1). .RE .SH EXIT STATUS .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR\fR .ad .sp .6 .RS 4n Successful execution. .RE .sp .ne 2 .na \fB\fB1\fR\fR .ad .sp .6 .RS 4n One or more subcommands resulted in failure. Error messages are written to the standard error stream. .RE .sp .ne 2 .na \fB\fB2\fR\fR .ad .sp .6 .RS 4n Invalid command line options were specified. .RE .SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability See below. .TE .sp .LP The interactive output is Uncommitted. The invocation and non-interactive output are Committed. .SH SEE ALSO .LP \fBsvcprop\fR(1), \fBsvcs\fR(1), \fBsvcadm\fR(1M), \fBsvc.configd\fR(1M), \fBlibscf\fR(3LIB), \fBlibumem\fR(3LIB), \fBscf_service_add_pg\fR(3SCF), \fBscf_value_create\fR(3SCF), \fBcontract\fR(4), \fBservice_bundle\fR(4), \fBattributes\fR(5), \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5), \fBsmf_security\fR(5), \fBsmf_template\fR(5)