]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-tmpfiles.xml
final v236 update (#7649)
[thirdparty/systemd.git] / man / systemd-tmpfiles.xml
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">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2010 Lennart Poettering
11
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.
16
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.
21
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/>.
24 -->
25
26 <refentry id="systemd-tmpfiles"
27 xmlns:xi="http://www.w3.org/2001/XInclude">
28
29 <refentryinfo>
30 <title>systemd-tmpfiles</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd-tmpfiles</refentrytitle>
45 <manvolnum>8</manvolnum>
46 </refmeta>
47
48 <refnamediv>
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>
56 </refnamediv>
57
58 <refsynopsisdiv>
59 <cmdsynopsis>
60 <command>systemd-tmpfiles</command>
61 <arg choice="opt" rep="repeat">OPTIONS</arg>
62 <arg choice="opt" rep="repeat"><replaceable>CONFIGFILE</replaceable></arg>
63 </cmdsynopsis>
64
65 <para>System units:
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>
70
71 <para>User units:
72 <literallayout><filename>systemd-tmpfiles-setup.service</filename>
73 <filename>systemd-tmpfiles-clean.service</filename>
74 <filename>systemd-tmpfiles-clean.timer</filename></literallayout></para>
75 </refsynopsisdiv>
76
77 <refsect1>
78 <title>Description</title>
79
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>.
84 </para>
85
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>
93 </refsect1>
94
95 <refsect1>
96 <title>Options</title>
97
98 <para>The following options are understood:</para>
99
100 <variablelist>
101 <varlistentry>
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>,
115 <varname>m</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>
125 </varlistentry>
126
127 <varlistentry>
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>
132 </varlistentry>
133
134 <varlistentry>
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>
141 </varlistentry>
142
143 <varlistentry>
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>
147 </varlistentry>
148
149 <varlistentry>
150 <term><option>--boot</option></term>
151 <listitem><para>Also execute lines with an exclamation mark.
152 </para></listitem>
153 </varlistentry>
154
155 <varlistentry>
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>
160 </varlistentry>
161 <varlistentry>
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>
166 </varlistentry>
167
168 <varlistentry>
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>
172
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>
177 </varlistentry>
178
179 <xi:include href="standard-options.xml" xpointer="help" />
180 <xi:include href="standard-options.xml" xpointer="version" />
181 </variablelist>
182
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>
188
189 <programlisting>systemd-tmpfiles --remove --create</programlisting>
190
191 </refsect1>
192
193 <refsect1>
194 <title>Unprivileged --cleanup operation</title>
195
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
201 their cleanup.
202 </para>
203 </refsect1>
204
205 <refsect1>
206 <title>Exit status</title>
207
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>).
213 </para>
214 </refsect1>
215
216 <refsect1>
217 <title>See Also</title>
218 <para>
219 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
220 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
221 </para>
222 </refsect1>
223
224 </refentry>