1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2010 Lennart Poettering
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"systemd-tmpfiles"
27 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
30 <title>systemd-tmpfiles
</title>
31 <productname>systemd
</productname>
35 <contrib>Developer
</contrib>
36 <firstname>Lennart
</firstname>
37 <surname>Poettering
</surname>
38 <email>lennart@poettering.net
</email>
44 <refentrytitle>systemd-tmpfiles
</refentrytitle>
45 <manvolnum>8</manvolnum>
49 <refname>systemd-tmpfiles
</refname>
50 <refname>systemd-tmpfiles-setup.service
</refname>
51 <refname>systemd-tmpfiles-setup-dev.service
</refname>
52 <refname>systemd-tmpfiles-clean.service
</refname>
53 <refname>systemd-tmpfiles-clean.timer
</refname>
54 <refpurpose>Creates, deletes and cleans up volatile
55 and temporary files and directories
</refpurpose>
60 <command>systemd-tmpfiles
</command>
61 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
62 <arg choice=
"opt" rep=
"repeat"><replaceable>CONFIGFILE
</replaceable></arg>
66 <literallayout><filename>systemd-tmpfiles-setup.service
</filename>
67 <filename>systemd-tmpfiles-setup-dev.service
</filename>
68 <filename>systemd-tmpfiles-clean.service
</filename>
69 <filename>systemd-tmpfiles-clean.timer
</filename></literallayout></para>
72 <literallayout><filename>systemd-tmpfiles-setup.service
</filename>
73 <filename>systemd-tmpfiles-clean.service
</filename>
74 <filename>systemd-tmpfiles-clean.timer
</filename></literallayout></para>
78 <title>Description
</title>
80 <para><command>systemd-tmpfiles
</command> creates, deletes, and
81 cleans up volatile and temporary files and directories, based on
82 the configuration file format and location specified in
83 <citerefentry><refentrytitle>tmpfiles.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
86 <para>If invoked with no arguments, it applies all directives from all configuration
87 files. If one or more absolute filenames are passed on the command line, only the
88 directives in these files are applied. If
<literal>-
</literal> is specified instead
89 of a filename, directives are read from standard input. If only the basename of a
90 configuration file is specified, all configuration directories as specified in
91 <citerefentry><refentrytitle>tmpfiles.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
92 are searched for a matching file.
</para>
96 <title>Options
</title>
98 <para>The following options are understood:
</para>
102 <term><option>--create
</option></term>
103 <listitem><para>If this option is passed, all files and
104 directories marked with
105 <varname>f
</varname>,
106 <varname>F
</varname>,
107 <varname>w
</varname>,
108 <varname>d
</varname>,
109 <varname>D
</varname>,
110 <varname>v
</varname>,
111 <varname>p
</varname>,
112 <varname>L
</varname>,
113 <varname>c
</varname>,
114 <varname>b
</varname>,
116 in the configuration files are created or written to. Files
117 and directories marked with
118 <varname>z
</varname>,
119 <varname>Z
</varname>,
120 <varname>t
</varname>,
121 <varname>T
</varname>,
122 <varname>a
</varname>, and
123 <varname>A
</varname> have their ownership, access mode and
124 security labels set.
</para></listitem>
128 <term><option>--clean
</option></term>
129 <listitem><para>If this option is passed, all files and
130 directories with an age parameter configured will be cleaned
131 up.
</para></listitem>
135 <term><option>--remove
</option></term>
136 <listitem><para>If this option is passed, the contents of
137 directories marked with
<varname>D
</varname> or
138 <varname>R
</varname>, and files or directories themselves
139 marked with
<varname>r
</varname> or
<varname>R
</varname> are
140 removed.
</para></listitem>
144 <term><option>--user
</option></term>
145 <listitem><para>Execute
"user" configuration, i.e.
<filename>tmpfiles.d
</filename>
146 files in user configuration directories.
</para></listitem>
150 <term><option>--boot
</option></term>
151 <listitem><para>Also execute lines with an exclamation mark.
156 <term><option>--prefix=
<replaceable>path
</replaceable></option></term>
157 <listitem><para>Only apply rules with paths that start with
158 the specified prefix. This option can be specified multiple
159 times.
</para></listitem>
162 <term><option>--exclude-prefix=
<replaceable>path
</replaceable></option></term>
163 <listitem><para>Ignore rules with paths that start with the
164 specified prefix. This option can be specified multiple
165 times.
</para></listitem>
169 <term><option>--root=
<replaceable>root
</replaceable></option></term>
170 <listitem><para>Takes a directory path as an argument. All paths will be prefixed with the given alternate
171 <replaceable>root
</replaceable> path, including config search paths.
</para>
173 <para>Note that this option does not alter how the users and groups specified in the configuration files are
174 resolved. With or without this option, users and groups are always resolved according to the host's user and
175 group databases, any such databases stored under the specified root directories are not
176 consulted.
</para></listitem>
179 <xi:include href=
"standard-options.xml" xpointer=
"help" />
180 <xi:include href=
"standard-options.xml" xpointer=
"version" />
183 <para>It is possible to combine
<option>--create
</option>,
184 <option>--clean
</option>, and
<option>--remove
</option> in one
185 invocation. For example, during boot the following command line is
186 executed to ensure that all temporary and volatile directories are
187 removed and created according to the configuration file:
</para>
189 <programlisting>systemd-tmpfiles --remove --create
</programlisting>
194 <title>Unprivileged --cleanup operation
</title>
196 <para><command>systemd-tmpfiles
</command> tries to avoid changing
197 the access and modification times on the directories it accesses,
198 which requires
<constant>CAP_ADMIN
</constant> privileges. When
199 running as non-root, directories which are checked for files to
200 clean up will have their access time bumped, which might prevent
206 <title>Exit status
</title>
208 <para>On success,
0 is returned. If the configuration was invalid (invalid syntax, missing
209 arguments, …), so some lines had to be ignored, but no other errors occurred,
210 <constant>65</constant> is returned (
<constant>EX_DATAERR
</constant> from
211 <filename>/usr/include/sysexits.h
</filename>). Otherwise,
<constant>1</constant> is returned
212 (
<constant>EXIT_FAILURE
</constant> from
<filename>/usr/include/stdlib.h
</filename>).
217 <title>See Also
</title>
219 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
220 <citerefentry><refentrytitle>tmpfiles.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>