]> git.proxmox.com Git - systemd.git/blob - man/systemd.preset.html
Imported Upstream version 219
[systemd.git] / man / systemd.preset.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd.preset</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="systemd.preset"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd.preset — Service enablement presets</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename">/etc/systemd/system-preset/*.preset</code></p><p><code class="filename">/run/systemd/system-preset/*.preset</code></p><p><code class="filename">/usr/lib/systemd/system-preset/*.preset</code></p><p><code class="filename">/etc/systemd/user-preset/*.preset</code></p><p><code class="filename">/run/systemd/user-preset/*.preset</code></p><p><code class="filename">/usr/lib/systemd/user-preset/*.preset</code></p></div><div class="refsect1"><a name="idm140239730136768"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>Preset files may be used to encode policy which units shall
23 be enabled by default and which ones shall be disabled. They are
24 read by <span class="command"><strong>systemctl preset</strong></span> (for more information
25 see
26 <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>)
27 which uses this information to enable or disable a unit according
28 to preset policy. <span class="command"><strong>systemctl preset</strong></span> is used by
29 the post install scriptlets of RPM packages (or other OS package
30 formats), to enable/disable specific units by default on package
31 installation, enforcing distribution, spin or administrator preset
32 policy. This allows choosing a certain set of units to be
33 enabled/disabled even before installing the actual package.</p><p>For more information on the preset logic please have a look
34 at the <a class="ulink" href="http://freedesktop.org/wiki/Software/systemd/Preset" target="_top">Presets</a>
35 document.</p><p>It is not recommended to ship preset files within the
36 respective software packages implementing the units, but rather
37 centralize them in a distribution or spin default policy, which
38 can be amended by administrator policy.</p><p>If no preset files exist, <span class="command"><strong>systemctl
39 preset</strong></span> will enable all units that are installed by
40 default. If this is not desired and all units shall rather be
41 disabled, it is necessary to ship a preset file with a single,
42 catchall "<code class="filename">disable *</code>" line. (See example 1,
43 below.)</p></div><div class="refsect1"><a name="idm140239730128896"></a><h2 id="Preset File Format">Preset File Format<a class="headerlink" title="Permalink to this headline" href="#Preset%20File%20Format"></a></h2><p>The preset files contain a list of directives consisting of
44 either the word "<code class="literal">enable</code>" or
45 "<code class="literal">disable</code>" followed by a space and a unit name
46 (possibly with shell style wildcards), separated by newlines.
47 Empty lines and lines whose first non-whitespace character is # or
48 ; are ignored.</p><p>Two different directives are understood:
49 "<code class="literal">enable</code>" may be used to enable units by default,
50 "<code class="literal">disable</code>" to disable units by default.</p><p>If multiple lines apply to a unit name, the first matching
51 one takes precedence over all others.</p><p>Each preset file shall be named in the style of
52 <code class="filename">&lt;priority&gt;-&lt;program&gt;.conf</code>. Files
53 in <code class="filename">/etc/</code> override files with the same name in
54 <code class="filename">/usr/lib/</code> and <code class="filename">/run/</code>.
55 Files in <code class="filename">/run/</code> override files with the same
56 name in <code class="filename">/usr/lib/</code>. Packages should install
57 their preset files in <code class="filename">/usr/lib/</code>. Files in
58 <code class="filename">/etc/</code> are reserved for the local
59 administrator, who may use this logic to override the preset files
60 installed by vendor packages. All preset files are sorted by their
61 filename in lexicographic order, regardless of which of the
62 directories they reside in. If multiple files specify the same
63 unit name, the entry in the file with the lexicographically
64 earliest name will be applied. It is recommended to prefix all
65 filenames with a two-digit number and a dash, to simplify the
66 ordering of the files.</p><p>If the administrator wants to disable a preset file supplied
67 by the vendor, the recommended way is to place a symlink to
68 <code class="filename">/dev/null</code> in
69 <code class="filename">/etc/systemd/system-preset/</code> bearing the same
70 filename.</p></div><div class="refsect1"><a name="idm140239734014272"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example"></a></h2><div class="example"><a name="idm140239734013600"></a><p class="title"><b>Example 1. Default off example <code class="filename">/usr/lib/systemd/system-preset/99-default.preset</code>:</b></p><div class="example-contents"><pre class="programlisting">disable *</pre></div></div><br class="example-break"><p>This disables all units. Due to the filename prefix
71 "<code class="literal">99-</code>", it will be read last and hence can easily
72 be overridden by spin or administrator preset policy or
73 suchlike.</p><div class="example"><a name="idm140239734010192"></a><p class="title"><b>Example 2. A GNOME spin example <code class="filename">/usr/lib/systemd/system-preset/50-gnome.preset</code>:</b></p><div class="example-contents"><pre class="programlisting">enable gdm.service
74 enable colord.service
75 enable accounts-daemon.service
76 enable avahi-daemon.*</pre></div></div><br class="example-break"><p>This enables the three mentioned units, plus all
77 <code class="filename">avahi-daemon</code> regardless of which unit type. A
78 file like this could be useful for inclusion in a GNOME spin of a
79 distribution. It will ensure that the units necessary for GNOME
80 are properly enabled as they are installed. It leaves all other
81 units untouched, and subject to other (later) preset files, for
82 example like the one from the first example above.</p><div class="example"><a name="idm140239733999184"></a><p class="title"><b>Example 3. Administrator policy <code class="filename">/etc/systemd/system-preset/00-lennart.preset</code>:</b></p><div class="example-contents"><pre class="programlisting">enable httpd.service
83 enable sshd.service
84 enable postfix.service
85 disable *</pre></div></div><br class="example-break"><p>This enables three specific services and disables all
86 others. This is useful for administrators to specifically select
87 the units to enable, and disable all others. Due to the filename
88 prefix "<code class="literal">00-</code>" it will be read early and hence
89 overrides all other preset policy files.</p></div><div class="refsect1"><a name="idm140239733995680"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
90 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
91 <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
92 <a href="systemd-delta.html"><span class="citerefentry"><span class="refentrytitle">systemd-delta</span>(1)</span></a>
93 </p></div></div></body></html>