<!--
SPDX-License-Identifier: LGPL-2.1+
- This file is part of systemd.
-
- Copyright 2010 Brandon Philips
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
+ Copyright © 2010 Brandon Philips
-->
<refentry id="tmpfiles.d">
<refentryinfo>
<title>tmpfiles.d</title>
<productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>Documentation</contrib>
- <firstname>Brandon</firstname>
- <surname>Philips</surname>
- <email>brandon@ifup.org</email>
- </author>
- </authorgroup>
</refentryinfo>
<refmeta>
</refnamediv>
<refsynopsisdiv>
- <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
- <para><filename>/run/tmpfiles.d/*.conf</filename></para>
- <para><filename>/usr/lib/tmpfiles.d/*.conf</filename></para>
+ <para><literallayout><filename>/etc/tmpfiles.d/*.conf</filename>
+<filename>/run/tmpfiles.d/*.conf</filename>
+<filename>/usr/lib/tmpfiles.d/*.conf</filename>
+ </literallayout></para>
+
+ <para><literallayout><filename>~/.config/user-tmpfiles.d/*.conf</filename>
+<filename>$XDG_RUNTIME_DIR/user-tmpfiles.d/*.conf</filename>
+<filename>~/.local/share/user-tmpfiles.d/*.conf</filename>
+<filename>…</filename>
+<filename>/usr/share/user-tmpfiles.d/*.conf</filename>
+ </literallayout></para>
</refsynopsisdiv>
<refsect1>
<variablelist>
<varlistentry>
<term><varname>f</varname></term>
- <listitem><para>Create a file if it does not exist yet. If
- the argument parameter is given, it will be written to the
- file. Does not follow symlinks.</para></listitem>
+ <listitem><para>Create a file if it does not exist yet. If the argument parameter is given and the file did
+ not exist yet, it will be written to the file. Does not follow symlinks.</para></listitem>
</varlistentry>
<varlistentry>
The second line in contrast to the first one would break a
running system, and will only be executed with
<option>--boot</option>.</para>
+
+ <para>Note that for all line types that result in creation of any kind of file node
+ (i.e. <varname>f</varname>/<varname>F</varname>,
+ <varname>d</varname>/<varname>D</varname>/<varname>v</varname>/<varname>q</varname>/<varname>Q</varname>,
+ <varname>p</varname>, <varname>L</varname>, <varname>c</varname>/<varname>b</varname> and <varname>C</varname>)
+ leading directories are implicitly created if needed, owned by root with an access mode of 0755. In order to
+ create them with different modes or ownership make sure to add appropriate <varname>d</varname> lines.</para>
</refsect2>
<refsect2>
<literal>~</literal>, 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.</para>
+
+ <para>The age of a file system entry is determined from its last
+ modification timestamp (mtime), its last access timestamp (atime),
+ and (except for directories) its last status change timestamp
+ (ctime). Any of these three (or two) values will prevent cleanup
+ if it is more recent than the current time minus the age
+ field.</para>
</refsect2>
<refsect2>
<title>Argument</title>
- <para>For <varname>L</varname> lines determines the destination
- path of the symlink. For <varname>c</varname> and
- <varname>b</varname>, determines the major/minor of the device
- node, with major and minor formatted as integers, separated by
- <literal>:</literal>, e.g. <literal>1:3</literal>. For
- <varname>f</varname>, <varname>F</varname>, and
- <varname>w</varname>, the argument may be used to specify a short string that
- is written to the file, suffixed by a newline. For
- <varname>C</varname>, specifies the source file or
- directory. For <varname>t</varname> and <varname>T</varname>,
- determines extended attributes to be set. For
- <varname>a</varname> and <varname>A</varname>, determines ACL
- attributes to be set. For <varname>h</varname> and
- <varname>H</varname>, determines the file attributes to
- set. Ignored for all other lines.</para>
+ <para>For <varname>L</varname> lines determines the destination path of the symlink. For <varname>c</varname> and
+ <varname>b</varname>, determines the major/minor of the device node, with major and minor formatted as integers,
+ separated by <literal>:</literal>, e.g. <literal>1:3</literal>. For <varname>f</varname>, <varname>F</varname>,
+ and <varname>w</varname>, the argument may be used to specify a short string that is written to the file,
+ suffixed by a newline. For <varname>C</varname>, specifies the source file or directory. For <varname>t</varname>
+ and <varname>T</varname>, determines extended attributes to be set. For <varname>a</varname> and
+ <varname>A</varname>, determines ACL attributes to be set. For <varname>h</varname> and <varname>H</varname>,
+ determines the file attributes to set. Ignored for all other lines.</para>
<para>This field can contain specifiers, see below.</para>
</refsect2>
</row>
</thead>
<tbody>
- <row>
- <entry><literal>%m</literal></entry>
- <entry>Machine ID</entry>
- <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
- </row>
<row>
<entry><literal>%b</literal></entry>
<entry>Boot ID</entry>
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
</row>
+ <row>
+ <entry><literal>%C</literal></entry>
+ <entry>System or user cache directory</entry>
+ <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CACHE_HOME</varname>, and <filename>/var/cache</filename> otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>%h</literal></entry>
+ <entry>User home directory</entry>
+ <entry>This is the home directory of the user running the command. In case of the system instance this resolves to <literal>/root</literal>.</entry>
+ </row>
<row>
<entry><literal>%H</literal></entry>
<entry>Host name</entry>
<entry>The hostname of the running system.</entry>
</row>
+ <row>
+ <entry><literal>%L</literal></entry>
+ <entry>System or user log directory</entry>
+ <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname> with <filename noindex='true'>/log</filename> appended, and <filename>/var/log</filename> otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>%m</literal></entry>
+ <entry>Machine ID</entry>
+ <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
+ </row>
+ <row>
+ <entry><literal>%S</literal></entry>
+ <entry>System or user state directory</entry>
+ <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname>, and <filename>/var/lib</filename> otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>%t</literal></entry>
+ <entry>System or user runtime directory</entry>
+ <entry>In --user mode, this is the same <varname>$XDG_RUNTIME_DIR</varname>, and <filename>/run</filename> otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>%T</literal></entry>
+ <entry>Directory for temporary files</entry>
+ <entry>This is either <filename>/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
+ </row>
+ <row>
+ <entry><literal>%u</literal></entry>
+ <entry>User name</entry>
+ <entry>This is the name of the user running the command. In case of the system instance this resolves to <literal>root</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>%U</literal></entry>
+ <entry>User UID</entry>
+ <entry>This is the numeric UID of the user running the command. In case of the system instance this resolves to <constant>0</constant>.</entry>
+ </row>
<row>
<entry><literal>%v</literal></entry>
<entry>Kernel release</entry>
<entry>Identical to <command>uname -r</command> output.</entry>
</row>
+ <row>
+ <entry><literal>%V</literal></entry>
+ <entry>Directory for larger and persistent temporary files</entry>
+ <entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
+ </row>
<row>
<entry><literal>%%</literal></entry>
- <entry>Escaped %</entry>
+ <entry>Escaped <literal>%</literal></entry>
<entry>Single percent sign.</entry>
</row>
</tbody>
</programlisting>
<para>Contents of <filename>/run/screens</filename> and /run/uscreens will
- cleaned up after 10 and 10½ days, respectively.</para>
+ be cleaned up after 10 and 10½ days, respectively.</para>
</example>
<example>