Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

svcio (1)

Name

svcio - create text files based on service configuration properties

Synopsis

/lib/svc/bin/svcio [-alux] [-D name=value]... [-f FMRI-instance]
	 [-g group] [-i file] [-m mode] [-o file]
	 [-O owner] [-R dir [-L opts [-p]]] [-S dir]

Description

The svcio utility reads a template known as a stencil and emits text based on that file in conjunction with the properties from a service instance. In the typical case, svcio is used to generate application-specific configuration files for services that are managed by, but are not able to read their configurations from, SMF.

If the stencil itself contains any errors, svcio will provide a snippet of text along with a line number and the cause of the error. Unless the error would prevent further progress, each error is printed in the order it occurs in the file.

Error messages are printed to the standard error stream.

Options

The following options are supported:

–a

Process all files configured for an instance.

Specifically, svcio will look at all property groups with the type "configfile" and determine which stencil to use and where to write the resulting file by examining the values of the properties path and stencil within that property group. For example, if property group "conf1" is of the appropriate type, then svcio will use the value of "conf1/stencil" as the path of the stencil file and "conf1/path" as the path of the file to which to write the output. Additionally, the optional properties owner and group can be used to set the owner and group of the output file respectively. If the property group name or property name contains a reserved character, then it must be encoded. If the property group is nested within another property group then it also must be encoded and indicate the full ancestry of the property group. For more information, see the smf(7) man page.

–D name=value

Defines name as a macro with no arguments, which provides a simple text substitution of the specified value. These macros may also be specified as properties in a property group named defines, that is nested within the configfile property group specifying the stencil, and will only be available within that context.

–f FMRI-instance

The FMRI of a service instance to run the stencil against.

–g group

The group to associate the output files with.

–i file

The path to the stencil file (default is stdin). This option cannot be used with –a option.

–l

Lists all properties that would be referenced were a file is to be output.

–L opts

Specifies options to be passed to mount(2) when loopback mounting output files. If this option is not specified, output files will not be loopback mounted. The –R switch is required with this option. A regular file will be written to the specified output path, rooted at prefix. This file will be loopback mounted to the specified output path, rooted at / or the value of the –R option.

–m mode

Sets the mode for any output file (default is 644).

–o file

The path to the output file (default is stdout). This option cannot be used with –a option.

–O owner

Sets the owner of the output files.

–R prefix

Sets the root prefix for all output files.

–p

Creates non-existent intermediate directories in the output file path rooted at the value of the –R option. Note that this option will not create directories that are missing in the path to the mount point.

–S dir

Looks for stencils in this directory rather than the default.

–u

Unlinks output files and undo loopback mounting. No output files will be created.

–x

Terminates svcio on the first error rather than continuing to the next stencil.

Operands

The following operands are supported:

FMRI

A fault management resource identifier (FMRI) that specifies one or more instances (see smf(7)). FMRIs can be abbreviated by specifying the instance name, or the trailing portion of the service name. For example, given the FMRI:

svc:/network/smtp:sendmail

The following are valid abbreviations:

sendmail
:sendmail
smtp
smtp:sendmail
network/smtp

The following are invalid abbreviations:

mail
network
network/smt

If the FMRI specifies a service, then the command applies to all instances of that service, except when used with the –D option.

Abbreviated forms of FMRIs are unstable, and should not be used in scripts or other permanent tools.

FMRI-instance

An FMRI that specifies an instance.

Examples

Example 1 Processing All Configuration Files for an Instance

This example processes all configured configuration files for an instance:

example% svcio -a -f svc:/service:instance
Example 2 Removing All Configuration Files for an Instance

This example unlinks and unmounts all configured configuration files for an instance:

example% svcio -au -f svc:/service:instance
Example 3 Using an Unconfigured Stencil for an Instance

This example produces an output file based on a stencil that has not been configured:

example% svcio -o /etc/svc.conf -i ~/svc.stencil \
       -f svc:/service1:instance

Exit Status

The following exit values are returned:

0

Successful command invocation.

1

A fatal error occurred as a result of a failed system call.

2

Invalid command line options were specified.

3

A fatal error occurred as a result of an unexpected SMF error.

4

An error occurred parsing a stencil.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
Interface Stability
Committed

See Also

svcprop(1), svcs(1), stat(2), libscf(3LIB), smf_stencil(5), smf(7), svc.startd(8), svcadm(8), svccfg(8)