]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
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>· | |
14228c0d | 22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</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="idm274698508048"></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 |
663996b3 MS |
23 | units shall be enabled by default and which ones |
24 | shall be disabled. They are read by <span class="command"><strong>systemctl | |
25 | preset</strong></span> (for more information 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 | |
28 | unit according to preset policy. <span class="command"><strong>systemctl | |
29 | preset</strong></span> is used by the post install | |
30 | scriptlets of RPM packages (or other OS package formats), | |
31 | to enable/disable specific units by default on package | |
32 | installation, enforcing distribution, spin or | |
33 | administrator preset policy. This allows choosing a certain | |
34 | set of units to be enabled/disabled even before | |
35 | installing the actual package.</p><p>For more information on the preset logic please | |
36 | have a look at the <a class="ulink" href="http://freedesktop.org/wiki/Software/systemd/Preset" target="_top">Presets</a> | |
37 | document.</p><p>It is not recommended to ship preset files | |
38 | within the respective software packages implementing | |
39 | the units, but rather centralize them in a | |
40 | distribution or spin default policy, which can be | |
41 | amended by administrator policy.</p><p>If no preset files exist, <span class="command"><strong>systemctl | |
42 | preset</strong></span> will enable all units that are | |
43 | installed by default. If this is not desired and all | |
14228c0d | 44 | units shall rather be disabled, it is necessary to ship |
663996b3 MS |
45 | a preset file with a single, catchall |
46 | "<code class="filename">disable *</code>" line. (See example 1, | |
14228c0d | 47 | below.)</p></div><div class="refsect1"><a name="idm274698377824"></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 |
663996b3 | 48 | directives consisting of either the word |
14228c0d MB |
49 | "<code class="literal">enable</code>" or |
50 | "<code class="literal">disable</code>" followed by a space and a | |
663996b3 MS |
51 | unit name (possibly with shell style wildcards), |
52 | separated by newlines. Empty lines and lines whose | |
53 | first non-whitespace character is # or ; are | |
54 | ignored.</p><p>Two different directives are understood: | |
14228c0d MB |
55 | "<code class="literal">enable</code>" may be used to enable units |
56 | by default, "<code class="literal">disable</code>" to disable | |
57 | units by default.</p><p>If multiple lines apply to a unit name, the | |
663996b3 MS |
58 | first matching one takes precedence over all |
59 | others.</p><p>Each preset file shall be named in the style of | |
60 | <code class="filename"><priority>-<program>.conf</code>. | |
61 | Files in <code class="filename">/etc/</code> override files | |
62 | with the same name in <code class="filename">/usr/lib/</code> | |
63 | and <code class="filename">/run/</code>. Files in | |
64 | <code class="filename">/run/</code> override files with the | |
65 | same name in <code class="filename">/usr/lib/</code>. Packages | |
66 | should install their preset files in | |
67 | <code class="filename">/usr/lib/</code>. Files in | |
68 | <code class="filename">/etc/</code> are reserved for the local | |
69 | administrator, who may use this logic to override the | |
70 | preset files installed by vendor packages. All preset | |
14228c0d | 71 | files are sorted by their filename in lexicographic |
663996b3 | 72 | order, regardless in which of the directories they |
14228c0d MB |
73 | reside. If multiple files specify the same unit name, |
74 | the entry in the file with the lexicographically earliest | |
75 | name will be applied. It is recommended to prefix all | |
76 | filenames with a two-digit number and a dash, to simplify | |
77 | the ordering of the files.</p><p>If the administrator wants to disable a preset | |
78 | file supplied by the vendor, the recommended way is to | |
663996b3 MS |
79 | place a symlink to <code class="filename">/dev/null</code> in |
80 | <code class="filename">/etc/systemd/system-preset/</code> | |
14228c0d MB |
81 | bearing the same filename.</p></div><div class="refsect1"><a name="idm274698562432"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><div class="example"><a name="idm274698561760"></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 |
82 | prefix "<code class="literal">99-</code>", it will be read last and | |
663996b3 | 83 | hence can easily be overridden by spin or |
14228c0d | 84 | administrator preset policy or suchlike.</p><div class="example"><a name="idm274698558320"></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 |
663996b3 MS |
85 | enable colord.service |
86 | enable accounts-daemon.service | |
87 | enable avahi-daemon.*</pre></div></div><br class="example-break"><p>This enables the three mentioned units, plus all | |
88 | <code class="filename">avahi-daemon</code> regardless of which | |
89 | unit type. A file like this could be useful for | |
90 | inclusion in a GNOME spin of a distribution. It will | |
91 | ensure that the units necessary for GNOME are properly | |
92 | enabled as they are installed. It leaves all other | |
93 | units untouched, and subject to other (later) preset | |
94 | files, for example like the one from the first example | |
14228c0d | 95 | above.</p><div class="example"><a name="idm274698547296"></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 |
663996b3 MS |
96 | enable sshd.service |
97 | enable postfix.service | |
98 | disable *</pre></div></div><br class="example-break"><p>This enables three specific services and | |
99 | disables all others. This is useful for administrators | |
100 | to specifically select the units to enable, and | |
14228c0d MB |
101 | disable all others. Due to the filename prefix |
102 | "<code class="literal">00-</code>" it will be read early and hence | |
103 | overrides all other preset policy files.</p></div><div class="refsect1"><a name="idm274698543584"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> | |
663996b3 MS |
104 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
105 | <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>, | |
106 | <a href="systemd-delta.html"><span class="citerefentry"><span class="refentrytitle">systemd-delta</span>(1)</span></a> | |
107 | </p></div></div></body></html> |