summaryrefslogtreecommitdiff
path: root/man/systemd.preset.html
blob: 87fea56d026c7a4f399d9318b22390cdad73bbcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<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>
    a.headerlink {
      color: #c60f0f;
      font-size: 0.8em;
      padding: 0 4px 0 4px;
      text-decoration: none;
      visibility: hidden;
    }

    a.headerlink:hover {
      background-color: #c60f0f;
      color: white;
    }

    h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
      visibility: visible;
    }
  </style><a href="index.html">Index </a>·
  <a href="systemd.directives.html">Directives </a>·
  <a href="../python-systemd/index.html">Python </a>·

  <span style="float:right">systemd 221</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="idm47134263530608"></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
    be enabled by default and which ones shall be disabled. They are
    read by <span class="command"><strong>systemctl preset</strong></span> (for more information
    see
    <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>)
    which uses this information to enable or disable a unit according
    to preset policy. <span class="command"><strong>systemctl preset</strong></span> 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.</p><p>For more information on the preset logic please have a look
    at the <a class="ulink" href="http://freedesktop.org/wiki/Software/systemd/Preset" target="_top">Presets</a>
    document.</p><p>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.</p><p>If no preset files exist, <span class="command"><strong>systemctl
    preset</strong></span> 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 "<code class="filename">disable *</code>" line. (See example 1,
    below.)</p></div><div class="refsect1"><a name="idm47134258621904"></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
    either the word "<code class="literal">enable</code>" or
    "<code class="literal">disable</code>" 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.</p><p>Two different directives are understood:
    "<code class="literal">enable</code>" may be used to enable units by default,
    "<code class="literal">disable</code>" to disable units by default.</p><p>If multiple lines apply to a unit name, the first matching
    one takes precedence over all others.</p><p>Each preset file shall be named in the style of
    <code class="filename">&lt;priority&gt;-&lt;program&gt;.conf</code>. Files
    in <code class="filename">/etc/</code> override files with the same name in
    <code class="filename">/usr/lib/</code> and <code class="filename">/run/</code>.
    Files in <code class="filename">/run/</code> override files with the same
    name in <code class="filename">/usr/lib/</code>. Packages should install
    their preset files in <code class="filename">/usr/lib/</code>. Files in
    <code class="filename">/etc/</code> 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.</p><p>If the administrator wants to disable a preset file supplied
    by the vendor, the recommended way is to place a symlink to
    <code class="filename">/dev/null</code> in
    <code class="filename">/etc/systemd/system-preset/</code> bearing the same
    filename.</p></div><div class="refsect1"><a name="idm47134258609472"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><div class="example"><a name="idm47134258608832"></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
    "<code class="literal">99-</code>", it will be read last and hence can easily
    be overridden by spin or administrator preset policy or
    suchlike.</p><div class="example"><a name="idm47134258605680"></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
enable colord.service
enable accounts-daemon.service
enable avahi-daemon.*</pre></div></div><br class="example-break"><p>This enables the three mentioned units, plus all
    <code class="filename">avahi-daemon</code> 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.</p><div class="example"><a name="idm47134258602160"></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
enable sshd.service
enable postfix.service
disable *</pre></div></div><br class="example-break"><p>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 "<code class="literal">00-</code>" it will be read early and hence
    overrides all other preset policy files.</p></div><div class="refsect1"><a name="idm47134258598688"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
      <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
      <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
      <a href="systemd-delta.html"><span class="citerefentry"><span class="refentrytitle">systemd-delta</span>(1)</span></a>
    </p></div></div></body></html>