systemd/man/systemd.preset.5
2015-02-17 11:22:16 +01:00

155 lines
5.7 KiB
Groff

'\" t
.TH "SYSTEMD\&.PRESET" "5" "" "systemd 219" "systemd.preset"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd.preset \- Service enablement presets
.SH "SYNOPSIS"
.PP
/etc/systemd/system\-preset/*\&.preset
.PP
/run/systemd/system\-preset/*\&.preset
.PP
/usr/lib/systemd/system\-preset/*\&.preset
.PP
/etc/systemd/user\-preset/*\&.preset
.PP
/run/systemd/user\-preset/*\&.preset
.PP
/usr/lib/systemd/user\-preset/*\&.preset
.SH "DESCRIPTION"
.PP
Preset files may be used to encode policy which units shall be enabled by default and which ones shall be disabled\&. They are read by
\fBsystemctl preset\fR
(for more information see
\fBsystemctl\fR(1)) which uses this information to enable or disable a unit according to preset policy\&.
\fBsystemctl preset\fR
is used by the post install scriptlets of RPM packages (or other OS package formats), to enable/disable specific units by default on package installation, enforcing distribution, spin or administrator preset policy\&. This allows choosing a certain set of units to be enabled/disabled even before installing the actual package\&.
.PP
For more information on the preset logic please have a look at the
\m[blue]\fBPresets\fR\m[]\&\s-2\u[1]\d\s+2
document\&.
.PP
It is not recommended to ship preset files within the respective software packages implementing the units, but rather centralize them in a distribution or spin default policy, which can be amended by administrator policy\&.
.PP
If no preset files exist,
\fBsystemctl preset\fR
will enable all units that are installed by default\&. If this is not desired and all units shall rather be disabled, it is necessary to ship a preset file with a single, catchall "disable *" line\&. (See example 1, below\&.)
.SH "PRESET FILE FORMAT"
.PP
The preset files contain a list of directives consisting of either the word
"enable"
or
"disable"
followed by a space and a unit name (possibly with shell style wildcards), separated by newlines\&. Empty lines and lines whose first non\-whitespace character is # or ; are ignored\&.
.PP
Two different directives are understood:
"enable"
may be used to enable units by default,
"disable"
to disable units by default\&.
.PP
If multiple lines apply to a unit name, the first matching one takes precedence over all others\&.
.PP
Each preset file shall be named in the style of
<priority>\-<program>\&.conf\&. Files in
/etc/
override files with the same name in
/usr/lib/
and
/run/\&. Files in
/run/
override files with the same name in
/usr/lib/\&. Packages should install their preset files in
/usr/lib/\&. Files in
/etc/
are reserved for the local administrator, who may use this logic to override the preset files installed by vendor packages\&. All preset files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in\&. If multiple files specify the same unit name, the entry in the file with the lexicographically earliest name will be applied\&. It is recommended to prefix all filenames with a two\-digit number and a dash, to simplify the ordering of the files\&.
.PP
If the administrator wants to disable a preset file supplied by the vendor, the recommended way is to place a symlink to
/dev/null
in
/etc/systemd/system\-preset/
bearing the same filename\&.
.SH "EXAMPLE"
.PP
\fBExample\ \&1.\ \&Default off example /usr/lib/systemd/system\-preset/99\-default\&.preset:\fR
.sp
.if n \{\
.RS 4
.\}
.nf
disable *
.fi
.if n \{\
.RE
.\}
.PP
This disables all units\&. Due to the filename prefix
"99\-", it will be read last and hence can easily be overridden by spin or administrator preset policy or suchlike\&.
.PP
\fBExample\ \&2.\ \&A GNOME spin example /usr/lib/systemd/system\-preset/50\-gnome\&.preset:\fR
.sp
.if n \{\
.RS 4
.\}
.nf
enable gdm\&.service
enable colord\&.service
enable accounts\-daemon\&.service
enable avahi\-daemon\&.*
.fi
.if n \{\
.RE
.\}
.PP
This enables the three mentioned units, plus all
avahi\-daemon
regardless of which unit type\&. A file like this could be useful for inclusion in a GNOME spin of a distribution\&. It will ensure that the units necessary for GNOME are properly enabled as they are installed\&. It leaves all other units untouched, and subject to other (later) preset files, for example like the one from the first example above\&.
.PP
\fBExample\ \&3.\ \&Administrator policy /etc/systemd/system\-preset/00\-lennart\&.preset:\fR
.sp
.if n \{\
.RS 4
.\}
.nf
enable httpd\&.service
enable sshd\&.service
enable postfix\&.service
disable *
.fi
.if n \{\
.RE
.\}
.PP
This enables three specific services and disables all others\&. This is useful for administrators to specifically select the units to enable, and disable all others\&. Due to the filename prefix
"00\-"
it will be read early and hence overrides all other preset policy files\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemctl\fR(1),
\fBsystemd-delta\fR(1)
.SH "NOTES"
.IP " 1." 4
Presets
.RS 4
\%http://freedesktop.org/wiki/Software/systemd/Preset
.RE