mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-03 16:10:30 +00:00
158 lines
18 KiB
HTML
158 lines
18 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>tmpfiles.d</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>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</span><hr><div class="refentry"><a name="tmpfiles.d"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tmpfiles.d — Configuration for creation, deletion and
|
||
cleaning of volatile and temporary files</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename">/etc/tmpfiles.d/*.conf</code></p><p><code class="filename">/run/tmpfiles.d/*.conf</code></p><p><code class="filename">/usr/lib/tmpfiles.d/*.conf</code></p></div><div class="refsect1"><a name="idm274693628464"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><span class="command"><strong>systemd-tmpfiles</strong></span> uses the
|
||
configuration files from the above directories to describe the
|
||
creation, cleaning and removal of volatile and
|
||
temporary files and directories which usually reside
|
||
in directories such as <code class="filename">/run</code>
|
||
or <code class="filename">/tmp</code>.</p></div><div class="refsect1"><a name="idm274693625040"></a><h2 id="Configuration Format">Configuration Format<a class="headerlink" title="Permalink to this headline" href="#Configuration%20Format">¶</a></h2><p>Each configuration file shall be named in the
|
||
style of <code class="filename"><package>.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 configuration 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
|
||
configuration files installed by vendor packages. All
|
||
configuration files are sorted by their filename in
|
||
lexicographic order, regardless in which of the
|
||
directories they reside. If multiple files specify the
|
||
same path, the entry in the file with the lexicographically
|
||
earliest name will be applied, all all other conflicting
|
||
entries logged as errors.</p><p>If the administrator wants to disable a
|
||
configuration 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/tmpfiles.d/</code> bearing the
|
||
same filename.</p><p>The configuration format is one line per path
|
||
containing action, path, mode, ownership, age and argument
|
||
fields:</p><pre class="programlisting">Type Path Mode UID GID Age Argument
|
||
d /run/user 0755 root root 10d -
|
||
L /tmp/foobar - - - - /dev/null</pre><div class="refsect2"><a name="idm274697518128"></a><h3 id="Type">Type<a class="headerlink" title="Permalink to this headline" href="#Type">¶</a></h3><p>The following line types are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="f"><span class="term"><code class="varname">f</code></span><a class="headerlink" title="Permalink to this term" href="#f">¶</a></dt><dd><p>Create a file if it does not exist yet (optionally writing a short string into it, if the argument parameter is passed)</p></dd><dt id="F"><span class="term"><code class="varname">F</code></span><a class="headerlink" title="Permalink to this term" href="#F">¶</a></dt><dd><p>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</p></dd><dt id="w"><span class="term"><code class="varname">w</code></span><a class="headerlink" title="Permalink to this term" href="#w">¶</a></dt><dd><p>Write the argument parameter to a file, if the file exists.
|
||
Lines of this type accept shell-style globs in place of normal path
|
||
names. The argument parameter will be written without a trailing
|
||
newline. C-style backslash escapes are interpreted.</p></dd><dt id="d"><span class="term"><code class="varname">d</code></span><a class="headerlink" title="Permalink to this term" href="#d">¶</a></dt><dd><p>Create a directory if it does not exist yet</p></dd><dt id="D"><span class="term"><code class="varname">D</code></span><a class="headerlink" title="Permalink to this term" href="#D">¶</a></dt><dd><p>Create or empty a directory</p></dd><dt id="p"><span class="term"><code class="varname">p</code></span><a class="headerlink" title="Permalink to this term" href="#p">¶</a></dt><dd><p>Create a named pipe (FIFO) if it does not exist yet</p></dd><dt id="L"><span class="term"><code class="varname">L</code></span><a class="headerlink" title="Permalink to this term" href="#L">¶</a></dt><dd><p>Create a symlink if it does not exist yet</p></dd><dt id="c"><span class="term"><code class="varname">c</code></span><a class="headerlink" title="Permalink to this term" href="#c">¶</a></dt><dd><p>Create a character device node if it does not exist yet</p></dd><dt id="b"><span class="term"><code class="varname">b</code></span><a class="headerlink" title="Permalink to this term" href="#b">¶</a></dt><dd><p>Create a block device node if it does not exist yet</p></dd><dt id="m"><span class="term"><code class="varname">m</code></span><a class="headerlink" title="Permalink to this term" href="#m">¶</a></dt><dd><p>If the
|
||
specified file path exists
|
||
adjust its access mode, group
|
||
and user to the specified
|
||
values and reset the SELinux
|
||
label. If it doesn't exist do
|
||
nothing.</p></dd><dt id="x"><span class="term"><code class="varname">x</code></span><a class="headerlink" title="Permalink to this term" href="#x">¶</a></dt><dd><p>Ignore a path
|
||
during cleaning. Use this type
|
||
to exclude paths from clean-up
|
||
as controlled with the Age
|
||
parameter. Note that lines of
|
||
this type do not influence the
|
||
effect of r or R lines. Lines
|
||
of this type accept
|
||
shell-style globs in place of
|
||
normal path
|
||
names.</p></dd><dt id="X"><span class="term"><code class="varname">X</code></span><a class="headerlink" title="Permalink to this term" href="#X">¶</a></dt><dd><p>Ignore a path
|
||
during cleanup. Use this type
|
||
to prevent path removal as
|
||
controlled with the Age parameter.
|
||
Note that if path is a directory,
|
||
content of a directory is not
|
||
excluded from clean-up, only
|
||
directory itself. Lines of this
|
||
type accept shell-style globs
|
||
in place of normal path
|
||
names.</p></dd><dt id="r"><span class="term"><code class="varname">r</code></span><a class="headerlink" title="Permalink to this term" href="#r">¶</a></dt><dd><p>Remove a file
|
||
or directory if it
|
||
exists. This may not be used
|
||
to remove non-empty
|
||
directories, use R for
|
||
that. Lines of this type
|
||
accept shell-style globs in
|
||
place of normal path
|
||
names.</p></dd><dt id="R"><span class="term"><code class="varname">R</code></span><a class="headerlink" title="Permalink to this term" href="#R">¶</a></dt><dd><p>Recursively
|
||
remove a path and all its
|
||
subdirectories (if it is a
|
||
directory). Lines of this type
|
||
accept shell-style globs in
|
||
place of normal path
|
||
names.</p></dd><dt id="z"><span class="term"><code class="varname">z</code></span><a class="headerlink" title="Permalink to this term" href="#z">¶</a></dt><dd><p>Restore
|
||
SELinux security context label
|
||
and set ownership and access
|
||
mode of a file or directory if
|
||
it exists. Lines of this type
|
||
accept shell-style globs in
|
||
place of normal path names.
|
||
</p></dd><dt id="Z"><span class="term"><code class="varname">Z</code></span><a class="headerlink" title="Permalink to this term" href="#Z">¶</a></dt><dd><p>Recursively
|
||
restore SELinux security
|
||
context label and set
|
||
ownership and access mode of a
|
||
path and all its
|
||
subdirectories (if it is a
|
||
directory). Lines of this type
|
||
accept shell-style globs in
|
||
place of normal path
|
||
names.</p></dd></dl></div></div><div class="refsect2"><a name="idm274697481904"></a><h3 id="Path">Path<a class="headerlink" title="Permalink to this headline" href="#Path">¶</a></h3><p>The file system path specification supports simple specifier
|
||
expansion. The following expansions are
|
||
understood:</p><div class="table"><a name="idm274697480704"></a><p class="title"><b>Table 1. Specifiers available</b></p><div class="table-contents"><table summary="Specifiers available" border="1"><colgroup><col align="left" class="spec"><col align="left" class="mean"><col align="left" class="detail"></colgroup><thead><tr><th align="left">Specifier</th><th align="left">Meaning</th><th align="left">Details</th></tr></thead><tbody><tr><td align="left">"<code class="literal">%m</code>"</td><td align="left">Machine ID</td><td align="left">The machine ID of the running system, formatted as string. See <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a> for more information.</td></tr><tr><td align="left">"<code class="literal">%b</code>"</td><td align="left">Boot ID</td><td align="left">The boot ID of the running system, formatted as string. See <a href="random.html"><span class="citerefentry"><span class="refentrytitle">random</span>(4)</span></a> for more information.</td></tr><tr><td align="left">"<code class="literal">%H</code>"</td><td align="left">Host name</td><td align="left">The hostname of the running system.</td></tr><tr><td align="left">"<code class="literal">%v</code>"</td><td align="left">Kernel release</td><td align="left">Identical to <span class="command"><strong>uname -r</strong></span> output.</td></tr><tr><td align="left">"<code class="literal">%%</code>"</td><td align="left">Escaped %</td><td align="left">Single percent sign.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect2"><a name="idm274692544320"></a><h3 id="Mode">Mode<a class="headerlink" title="Permalink to this headline" href="#Mode">¶</a></h3><p>The file access mode to use when
|
||
creating this file or directory. If omitted or
|
||
when set to -, the default is used: 0755 for
|
||
directories, 0644 for all other file
|
||
objects. For z, Z lines, if omitted or when set
|
||
to -, the file access mode will not be
|
||
modified. This parameter is ignored for x, r,
|
||
R, L lines.</p></div><div class="refsect2"><a name="idm274692542672"></a><h3 id="UID, GID">UID, GID<a class="headerlink" title="Permalink to this headline" href="#UID,%20GID">¶</a></h3><p>The user and group to use for this file
|
||
or directory. This may either be a numeric
|
||
user/group ID or a user or group name. If
|
||
omitted or when set to -, the default 0 (root)
|
||
is used. For z, Z lines, when omitted or when set to -,
|
||
the file ownership will not be modified.
|
||
These parameters are ignored for x, r, R, L lines.</p></div><div class="refsect2"><a name="idm274692541040"></a><h3 id="Age">Age<a class="headerlink" title="Permalink to this headline" href="#Age">¶</a></h3><p>The date field, when set, is used to
|
||
decide what files to delete when cleaning. If
|
||
a file or directory is older than the current
|
||
time minus the age field, it is deleted. The
|
||
field format is a series of integers each
|
||
followed by one of the following
|
||
postfixes for the respective time units:</p><div class="variablelist"><dl class="variablelist"><dt id="s"><span class="term"><code class="varname">s</code>, </span><span class="term"><code class="varname">min</code>, </span><span class="term"><code class="varname">h</code>, </span><span class="term"><code class="varname">d</code>, </span><span class="term"><code class="varname">w</code>, </span><span class="term"><code class="varname">ms</code>, </span><span class="term"><code class="varname">m</code>, </span><span class="term"><code class="varname">us</code></span><a class="headerlink" title="Permalink to this term" href="#s">¶</a></dt><dd></dd></dl></div><p>If multiple integers and units are specified, the time
|
||
values are summed up. If an integer is given without a unit,
|
||
s is assumed.
|
||
</p><p>When the age is set to zero, the files are cleaned
|
||
unconditionally.</p><p>The age field only applies to lines starting with
|
||
d, D and x. If omitted or set to -, no automatic clean-up
|
||
is done.</p><p>If the age field starts with a tilde
|
||
character (~), the clean-up is only applied to
|
||
files and directories one level inside the
|
||
directory specified, but not the files and
|
||
directories immediately inside it.</p></div><div class="refsect2"><a name="idm274692532336"></a><h3 id="Argument">Argument<a class="headerlink" title="Permalink to this headline" href="#Argument">¶</a></h3><p>For L lines determines the destination
|
||
path of the symlink. For c, b determines the
|
||
major/minor of the device node, with major and
|
||
minor formatted as integers, separated by :,
|
||
e.g. "1:3". For f, F, w may be used to specify
|
||
a short string that is written to the file,
|
||
suffixed by a newline. Ignored for all other
|
||
lines.</p></div></div><div class="refsect1"><a name="idm274692530560"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><div class="example"><a name="idm274692529920"></a><p class="title"><b>Example 1. /etc/tmpfiles.d/screen.conf example</b></p><div class="example-contents"><p><span class="command"><strong>screen</strong></span> needs two directories created at boot with specific modes and ownership.</p><pre class="programlisting">d /var/run/screens 1777 root root 10d
|
||
d /var/run/uscreens 0755 root root 10d12h</pre></div></div><br class="example-break"><div class="example"><a name="idm274692527552"></a><p class="title"><b>Example 2. /etc/tmpfiles.d/abrt.conf example</b></p><div class="example-contents"><p><span class="command"><strong>abrt</strong></span> needs a directory created at boot with specific mode and ownership and its content should be preserved.</p><pre class="programlisting">d /var/tmp/abrt 0755 abrt abrt
|
||
x /var/tmp/abrt/*</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm274692525024"></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="systemd-tmpfiles.html"><span class="citerefentry"><span class="refentrytitle">systemd-tmpfiles</span>(8)</span></a>,
|
||
<a href="systemd-delta.html"><span class="citerefentry"><span class="refentrytitle">systemd-delta</span>(1)</span></a>
|
||
</p></div></div></body></html>
|