2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 2012, Joyent, Inc. All Rights Reserved
4 .\" 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.
5 .\" 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
6 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SVCCFG 8 "May 13, 2017"
9 svccfg \- import, export, and modify service configurations
13 \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR]
18 \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR] \fIsubcommand\fR [\fBargs\fR]...
23 \fB/usr/sbin/svccfg\fR [\fB-v\fR] [\fB-s\fR \fIFMRI\fR] \fB-f\fR \fIcommand-file\fR
28 The \fBsvccfg\fR command manipulates data in the service configuration
29 repository. \fBsvccfg\fR can be invoked interactively, with an individual
30 subcommand, or by specifying a command file that contains a series of
34 Changes made to an existing service in the repository typically do not take
35 effect for that service until the next time the service instance is refreshed.
36 See the \fBrefresh\fR subcommand on the \fBsvcadm\fR(8) man page for more
40 The following options are supported:
44 \fB\fB-f\fR \fIcommand-file\fR\fR
48 Reads and executes \fBsvccfg\fR subcommands from \fIcommand-file\fR.
54 \fB\fB-s\fR \fIFMRI\fR\fR
58 Selects the entity indicated by \fIFMRI\fR (a fault management resource
59 identifier) before executing any subcommands. See \fBsmf\fR(5).
74 Subcommands are divided into the categories specified in the subsections that
78 All subcommands that accept \fIFMRI\fRs also accept abbreviated or globbed
79 patterns. Instances and services can be abbreviated by specifying the instance
80 name, or the trailing portion of the service name. For example, given the
85 svc:/network/smtp:sendmail
92 All the following are valid abbreviations:
107 While the following are invalid:
120 Abbreviated forms of \fIFMRI\fRs are unstable, and should not be used in
121 scripts or other permanent tools. If a pattern matches more than one instance
122 or service, an error message is printed and no action is taken.
123 .SS "General Subcommands"
144 \fB\fBrepository\fR \fIrepfile\fR\fR
148 Uses \fIrepfile\fR as a repository. By default, \fBsvccfg\fR(8) uses the
151 Use repository only with files from the identical version of Solaris, including
152 updates, that you are currently running. Do not use this subcommand with the
153 system repository, \fB/etc/svc/repository.db\fR.
159 \fB\fBset\fR [\fB-v\fR|\fB-V\fR]\fR
163 Sets optional behavior. If no options are specified, set displays the options
172 Turns on verbose mode.
182 Turns off verbose mode.
187 .SS "Service Profile Subcommands"
190 \fB\fBapply\fR [\fB-n\fR] \fIfile\fR\fR
194 If a \fIfile\fR is a service profile, properties, including general/enabled,
195 that are specified in the file are modified in the SMF repository.
196 Not-yet-existent properties and property groups will be created. The type of
197 the pre-existing property \fBgroups\fR will not be changed by the profile.
198 Existing properties (as distinguished from property groups) \fBcan\fR have
199 their type changed by the profile. Nonexistent services and instances are
200 ignored. Services and instances modified by the profile will be refreshed. If
201 \fB-n\fR is specified, the profile is processed and no changes are applied to
202 the SMF repository. Any syntax error found will be reported on stderr and an
203 exit code of \fB1\fR will be returned. See \fBsmf\fR(5) for a description of
204 service profiles. This command requires privileges to modify properties in the
205 service and instance. See \fBsmf_security\fR(5) for the privileges required to
206 modify properties. If \fIfile\fR is not a service profile, the subcommand
213 \fB\fBextract\fR [\fI> file\fR]\fR
217 Prints a service profile which represents the enabled status of the service
218 instances in the repository to standard output. The output may be redirected to
222 .SS "Service Manifest Subcommands"
225 \fB\fBarchive\fR [\fB-a\fR]\fR
229 Dumps a full \fBXML\fR service description for all services, instances, and
230 their persistent properties in the repository. This does not include transient
231 properties such as service state, and is suitable for a relocatable repository
234 Without the \fB-a\fR option, property groups containing protected information
235 (identified by the presence of the \fBread_authorization\fR property\(emsee
236 \fBsmf_security\fR(5)) will be archived without their property values. When the
237 \fB-a\fR option is specified, all values will be archived. An error results if
238 there are insufficient privileges to read these values.
244 \fB\fBexport\fR [\fB-a\fR] \fIservice_FMRI\fR [\fI>file\fR]\fR
248 The service description for the specified service and its instances is written
249 to standard output or redirected to the given file. Dependencies with a boolean
250 "external" property set to true are omitted in the belief that they were
251 created on behalf of another service.
253 Without the \fB-a\fR option, property groups containing protected information
254 (identified by the presence of the \fBread_authorization\fR property\(emsee
255 \fBsmf_security\fR(5)) will be exported without their property values. When the
256 \fB-a\fR option is specified, all values will be archived. An error results if
257 there are insufficient privileges to read these values.
259 Note that \fBexport\fR requires a service FMRI. To ease the use of arguments
260 cut and pasted from other command output, if you specify a complete
261 instance FMRI, the entire corresponding service including all instances
262 is exported and a warning is issued. If you specify an abbreviation, such as
263 \fBapache2\fR or \fBsendmail\fR, that specifies an instance, the command fails.
269 \fB\fBimport\fR [\fB-V\fR] \fIfile\fR\fR
273 If \fIfile\fR is a service manifest, then the services and instances it
274 specifies are imported into the repository. According to the file, dependencies
275 may be created in other services. See \fBsmf\fR(5) for a description of service
276 manifests. See \fBsmf_security\fR(5) for the privileges required to create and
277 modify service configurations.
279 Services and instances in the manifest will be validated against template data
280 in the manifest and the repository, and warnings will be issued for all
281 template violations. See \fBsmf_template\fR(5) for a description of templates.
282 If the \fB-V\fR option is specified, manifests that violate the defined
283 templates will fail to import. In interactive invocations of \fBsvccfg\fR,
284 \fB-V\fR is the default behavior.
286 For existing services and instances, properties which have not changed since
287 the last \fBimport\fR snapshot was taken are upgraded to those specified by the
288 manifest. Conflicts (properties which have been changed both in the repository
289 and the manifest) are reported on the standard error stream. \fBsvccfg\fR will
290 never upgrade the "general/enabled" and "general/restarter" properties, since
291 they represent administrator preference.
297 \fB\fBinventory\fR \fIfile\fR\fR
301 If \fIfile\fR is determined to be a service manifest, then the \fBFMRI\fRs of
302 the services and instances the \fIfile\fR describes are printed. For each
303 service, the \fBFMRI\fRs of its instances are displayed before the \fBFMRI\fR
314 Restores the contents of the repository from a full XML service description
315 previously created by the \fBarchive\fR subcommand. If the archive was
316 generated without the use of the \fB-a\fR option, the contents of the
317 repository following completion of the restore will not include the values of
318 any read-protected properties (see \fBsmf_security\fR(5)). If these are
319 required, they must be restored manually.
321 Restoring an archive which is inconsistent with currently installed software
322 (including patch revisions) might yield unpredictable results. Therefore, prior
323 to restoring an archive, all system and application software, including any
324 service manifests, should be restored to the same state it was in at the time
325 the archive was made.
331 \fB\fBvalidate\fR [\fIfile\fR | \fIfmri\fR]\fR
335 The \fBvalidate\fR subcommand can operate on a manifest file, an instance FMRI,
336 or the current instance or snapshot entity selection. When an argument is
337 specified, \fBsvccfg\fR will check to see whether the specified file exists. If
338 the file exists, it will be validated. If a file of the specified name does not
339 exist, the argument is treated as an FMRI pattern. If a conflict arises between
340 a filename and an FMRI, use the \fBsvc:\fR and \fBfile:\fR prefixes to tell
341 \fBsvccfg\fR how to interpret the argument.
343 When you specify a file, the file is processed in a manner similar to
344 \fBimport\fR \fB-V\fR, but no changes are made to the repository. If any errors
345 are detected, \fBsvccfg\fR displays the errors and exits with a nonzero exit
348 For an instance \fIfmri\fR, instance entity selection, or snapshot entity
349 selection, the specified instance in its composed form (see "Properties and
350 Property Groups" in \fBsmf\fR(5)) will be validated against template data in
351 the repository. Instance FMRIs and instance entity selections use the "running"
352 snapshot for validation. Warnings will be issued for all template violations.
353 See \fBsmf_template\fR(5) for a description of templates.
356 .SS "Entity Selection, Modification, and Navigation Subcommands"
358 An "entity" refers to a scope, service, or service instance.
362 \fB\fBadd\fR \fIname\fR\fR
366 A new entity with the given name is created as a child of the current
367 selection. See \fBsmf_security\fR(5) for the privileges required to create
374 \fB\fBdelete\fR [\fB-f\fR] \fB{\fIname\fR | \fIfmri\fR}\fR\fR
378 The named child of the current selection or the entity specified by \fIfmri\fR
379 is deleted. Attempts to delete service instances in the "online" or "degraded"
380 state will fail unless the \fB-f\fR flag is specified. If a service or service
381 instance has a "dependents" property group of type "framework", then for each
382 of its properties with type "astring" or "fmri", if the property has a single
383 value which names a service or service instance then the dependency property
384 group in the indicated service or service instance with the same name as the
385 property will be deleted. See \fBsmf_security\fR(5) for the privileges required
386 to delete service configurations.
392 \fB\fBlist\fR [\fIpattern\fR]\fR
396 The child entities of the current selection whose names match the glob pattern
397 \fIpattern\fR are displayed (see \fBfnmatch\fR(5)). \&':properties' is also
398 listed for property-bearing entities, namely services and service instances.
404 \fB\fBselect\fR {\fIname\fR | \fIfmri\fR}\fR
408 If the argument names a child of the current selection, it becomes the current
409 selection. Otherwise, the argument is interpreted as an \fBFMRI\fR and the
410 entity that the argument specifies becomes the current selection.
420 The parent of the current selection becomes the current selection.
423 .SS "Property Inspection and Modification Subcommands"
426 \fB\fBaddpg\fR \fIname\fR \fItype\fR [\fIflags\fR]\fR
430 Adds a property group with the given \fIname\fR and type to the current
431 selection. \fIflags\fR is a string of characters which designates the flags
432 with which to create the property group. 'P' represents
433 \fBSCF_PG_FLAG_NONPERSISTENT\fR (see \fBscf_service_add_pg\fR(3SCF)). See
434 \fBsmf_security\fR(5) for the privileges required to create property groups.
440 \fB\fBaddpropvalue\fR \fIpg\fR\fI/name\fR [\fItype:\fR] \fIvalue\fR\fR
444 Adds the given value to a property. If \fItype\fR is given and the property
445 exists, then if \fItype\fR does not agree with the property's \fItype\fR, the
446 subcommand fails. The values may be enclosed in double-quotes. String values
447 containing double-quotes or backslashes must be enclosed by double-quotes and
448 the contained double-quotes and backslashes must be quoted by backslashes.
449 Nonexistent properties are created, in which case the \fItype\fR specifier must
450 be present. See \fBscf_value_create\fR(3SCF) for a list of available property
451 types. See \fBsmf_security\fR(5) for the privileges required to modify
452 properties. The new value will be appended to the end of the list of property
453 values associated with the property.
459 \fB\fBdelpg\fR \fIname\fR\fR
463 Deletes the property group \fIname\fR of the current selection. See
464 \fBsmf_security\fR(5) for the privileges required to delete property groups.
470 \fB\fBdelprop\fR \fIpg\fR[\fI/name\fR]\fR
474 Deletes the named property group or property of the current selection. See
475 \fBsmf_security\fR(5) for the privileges required to delete properties.
481 \fB\fBdelpropvalue\fR \fIpg/name\fR \fIglobpattern\fR\fR
485 Deletes all values matching the given \fIglob\fR pattern in the named property.
486 Succeeds even if no values match. See \fBsmf_security\fR(5) for the privileges
487 required to modify properties.
493 \fB\fBdescribe\fR [\fB-v\fR] [\fB-t\fR] [\fIpropertygroup\fR/\fIproperty\fR]\fR
497 Describes either the current or the possible settings.
499 When invoked without arguments, \fBdescribe\fR gives basic descriptions (if
500 available) of the currently selected entity and all of its currently set
501 property groups and properties. A property group or specific property can be
502 queried by specifying either the property group name, or the property group
503 name and property name, separated by a slash (\fB/\fR), as an argument.
505 The \fB-v\fR option gives all information available, including descriptions for
506 current settings, constraints, and other possible setting choices.
508 The \fB-t\fR option shows only the template data for the selection (see
509 \fBsmf_template\fR(5)), and does not display the current settings for property
510 groups and properties.
520 Comments of commands to reproduce the property groups and properties of the
521 current selection are placed in a temporary file and the program named by the
522 \fBEDITOR\fR environment variable is invoked to edit it. Upon completion, the
523 commands in the temporary file are executed. The default editor is \fBvi\fR(1).
524 See \fBsmf_security\fR(5) for the privileges required to create, modify, or
531 \fB\fBlistpg\fR [\fIpattern\fR]\fR
535 Displays the names, types, and flags of property groups of the current
536 selection. If an argument is given, it is taken as a glob pattern and only
537 property groups with names which match the argument are listed.
539 In interactive mode, a basic description of the property groups is also given.
545 \fB\fBlistprop\fR [\fIpattern\fR]\fR
549 Lists property groups and properties of the current selection. For property
550 groups, names, types, and flags are listed. For properties, names (prepended by
551 the property group name and a slash (/)), types, and values are listed. See
552 \fBscf_value_create\fR(3SCF) for a list of available property types. If an
553 argument is supplied it is taken as a glob pattern and only property groups and
554 properties with names which match the argument are listed.
560 \fB\fBsetenv\fR [\fB-i\fR | \fB-s\fR] [\fB-m\fR \fImethod_name\fR] \fIenvvar
565 Sets a method environment variable for a service or instance by changing the
566 "environment" property in the \fImethod_name\fR property group, if that
567 property group has type "method". If \fImethod_name\fR is not specified and the
568 \fB-i\fR option is used, the "method_context" property group is used, if an
569 instance is currently selected. If the \fB-s\fR option is used and a service is
570 currently selected, its "method_context" property group is used. If the
571 \fB-s\fR option is used and an instance is currently selected, the
572 "method_context" property group of its parent is used. If neither the \fB-i\fR
573 option nor the \fB-s\fR option is used, the "start" property group is searched
574 for in the currently selected entity and, if an instance is currently selected,
575 its parent is also searched. If the "inetd_start" property group is not
576 located, it is searched for in a similar manner.
578 Once the property is located, all values which begin with \fIenvvar\fR followed
579 by a "=" are removed, and the value "\fIenvvar\fR=\fIvalue\fR" is added. See
580 \fBsmf_security\fR(5) for the privileges required to modify properties.
586 \fB\fBsetprop\fR \fIpg/name\fR = [\fItype:\fR] \fIvalue\fR\fR
590 \fBsetprop \fIpg/name\fR = [\fItype:\fR] ([\fIvalues ...\fR])\fR
594 Sets the \fIname\fR property of the \fIpg\fR property group of the current
595 selection to the given values of type \fItype\fR. See
596 \fBscf_value_create\fR(3SCF) for a list of available property types. If the
597 property already exists and the \fItype\fR disagrees with the existing
598 \fItype\fR on the property, the subcommand fails. Values may be enclosed in
599 double-quotes. String values which contain double-quotes or backslashes must be
600 enclosed by double-quotes and the contained double-quotes and backslashes must
601 be quoted by backslashes. If the named property does not exist, it is created,
602 as long as the type is specified. See \fBsmf_security\fR(5) for the privileges
603 required to create or modify properties. Multiple values will be stored in the
604 order in which they are specified.
610 \fB\fBunsetenv\fR [\fB-i\fR | \fB-s\fR] [\fB-m\fR \fImethod_name\fR] \fIenvvar
615 Removes a method environment variable for a service or instance by changing the
616 "environment" property in the \fImethod_name\fR property group, if that
617 property group has type "method". If \fImethod_name\fR is not specified and the
618 \fB-i\fR option is used, the "method_context" property group is used, if an
619 instance is currently selected. If the \fB-s\fR option is used and a service is
620 currently selected, its "method_context" property group is used. If the
621 \fB-s\fR option is used and an instance is currently selected, the
622 "method_context" property group of its parent is used. If neither the \fB-i\fR
623 option nor the \fB-s\fR option is used, the "start" property group is searched
624 for in the currently selected entity and, if an instance is currently selected,
625 its parent is also searched. If the "inetd_start" property group is not
626 located, it is searched for in a similar manner.
628 Once the property is located, all values which begin with \fIenvvar\fR followed
629 by "=" are removed. See \fBsmf_security\fR(5) for the privileges required to
633 .SS "Snapshot Navigation and Selection Subcommands"
640 Displays snapshots available for the currently selected instance.
646 \fB\fBrevert\fR [\fIsnapshot\fR]\fR
650 Reverts the properties of the currently selected instance and its service to
651 those recorded in the named snapshot. If no argument is given, use the
652 currently selected snapshot and deselect it on success. The changed property
653 values can be made active via the \fBrefresh\fR subcommand of \fBsvcadm\fR(8).
654 See \fBsmf_security\fR(5) for the privileges required to change properties.
660 \fB\fBselectsnap\fR [\fIname\fR]\fR
664 Changes the current snapshot to the one named by \fIname\fR. If no \fIname\fR
665 is specified, deselect the currently selected snapshot. Snapshots are
669 .SS "Instance Subcommands"
676 Commit the values from the current configuration to the running snapshot,
677 making them available for use by the currently selected instance. If the
678 repository subcommand has not been used to select a repository, direct the
679 instance's restarter to reread the updated configuration.
684 \fBExample 1 \fRImporting a Service Description
687 The following example imports a service description for the \fBseismic\fR
688 service in the XML manifest specified on the command line.
693 # \fBsvccfg import /var/svc/manifest/site/seismic.xml\fR
700 Note that the manifest must follow the format specified in
701 \fBservice_bundle\fR(4).
704 \fBExample 2 \fRExporting a Service Description
707 To export a service description on the local system:
712 # \fBsvccfg export dumpadm >/tmp/dump.xml\fR
718 \fBExample 3 \fRDeleting a Service Instance
721 To delete a service instance:
726 # \fBsvccfg delete network/inetd-upgrade:default\fR
732 \fBExample 4 \fRChecking Properties in an Alternate Repository
735 To examine the state of a service's properties after loading an alternate
736 repository, use the sequence of commands shown below. One might use such
737 commands, for example, to determine whether a service was enabled in a
738 particular repository backup.
744 svc:> \fBrepository /etc/svc/repository-boot\fR
745 svc:> \fBselect telnet:default\fR
746 svc:/network/telnet:default> \fBlistprop general/enabled\fR
747 general/enabled boolean false
748 svc:/network/telnet:default> \fBexit\fR
754 \fBExample 5 \fREnabling Debugging
757 To modify \fBLD_PRELOAD\fR for a start method and enable the use of
758 \fBlibumem\fR(3LIB) with debugging features active:
763 $ \fBsvccfg -s system/service setenv LD_PRELOAD libumem.so\fR
764 $ \fBsvccfg -s system/service setenv UMEM_DEBUG default\fR
770 \fBExample 6 \fRUsing \fBdescribe\fR Subcommand
773 The following command illustrates the use of the \fBdescribe\fR subcommand.
778 # \fBsvccfg -s console-login describe ttymon\fR
780 ttymon/device astring /dev/console
781 \fBterminal device to be used for the console login prompt\fR
782 ttymon/label astring console
783 \fBappropriate entry from /etc/ttydefs\fR
789 .SH ENVIRONMENTAL VARIABLES
796 The command to run when the \fBeditprop\fR subcommand is used. The default
797 editor is \fBvi\fR(1).
802 The following exit values are returned:
810 Successful execution.
820 One or more subcommands resulted in failure. Error messages are written to the
821 standard error stream.
831 Invalid command line options were specified.
836 See \fBattributes\fR(5) for descriptions of the following attributes:
844 ATTRIBUTE TYPE ATTRIBUTE VALUE
846 Interface Stability See below.
851 The interactive output is Uncommitted. The invocation and non-interactive
852 output are Committed.
855 \fBsvcprop\fR(1), \fBsvcs\fR(1), \fBsvcadm\fR(8), \fBsvc.configd\fR(8),
856 \fBlibscf\fR(3LIB), \fBlibumem\fR(3LIB), \fBscf_service_add_pg\fR(3SCF),
857 \fBscf_value_create\fR(3SCF), \fBcontract\fR(4), \fBservice_bundle\fR(4),
858 \fBattributes\fR(5), \fBfnmatch\fR(5), \fBsmf\fR(5), \fBsmf_method\fR(5),
859 \fBsmf_security\fR(5), \fBsmf_template\fR(5)