]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/tmpfiles.d.xml
man: specifiers are allow for argument field in tmpfiles
[thirdparty/systemd.git] / man / tmpfiles.d.xml
CommitLineData
5fb13eb5 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
12b42c76 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4149f86d 3<!--
572eb058
ZJS
4 SPDX-License-Identifier: LGPL-2.1+
5
4149f86d
BP
6 This file is part of systemd.
7
8 Copyright 2010 Brandon Philips
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
4149f86d
BP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
4149f86d 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
4149f86d
BP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23<refentry id="tmpfiles.d">
24
302fbdf2
ZJS
25 <refentryinfo>
26 <title>tmpfiles.d</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Documentation</contrib>
32 <firstname>Brandon</firstname>
33 <surname>Philips</surname>
34 <email>brandon@ifup.org</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>tmpfiles.d</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>tmpfiles.d</refname>
46 <refpurpose>Configuration for creation, deletion and cleaning of
47 volatile and temporary files</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
52 <para><filename>/run/tmpfiles.d/*.conf</filename></para>
53 <para><filename>/usr/lib/tmpfiles.d/*.conf</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para><command>systemd-tmpfiles</command> uses the configuration
60 files from the above directories to describe the creation,
61 cleaning and removal of volatile and temporary files and
62 directories which usually reside in directories such as
63 <filename>/run</filename> or <filename>/tmp</filename>.</para>
64
65 <para>Volatile and temporary files and directories are those
66 located in <filename>/run</filename> (and its alias
67 <filename>/var/run</filename>), <filename>/tmp</filename>,
68 <filename>/var/tmp</filename>, the API file systems such as
69 <filename>/sys</filename> or <filename>/proc</filename>, as well
70 as some other directories below <filename>/var</filename>.</para>
71
72 <para>System daemons frequently require private runtime
73 directories below <filename>/run</filename> to place communication
74 sockets and similar in. For these, consider declaring them in
75 their unit files using <varname>RuntimeDirectory=</varname> (see
76 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
77 for details), if this is feasible.</para>
78 </refsect1>
79
80 <refsect1>
8165be2e 81 <title>Configuration Directories and Precedence</title>
302fbdf2
ZJS
82
83 <para>Each configuration file shall be named in the style of
84 <filename><replaceable>package</replaceable>.conf</filename> or
85 <filename><replaceable>package</replaceable>-<replaceable>part</replaceable>.conf</filename>.
86 The second variant should be used when it is desirable to make it
87 easy to override just this part of configuration.</para>
88
89 <para>Files in <filename>/etc/tmpfiles.d</filename> override files
90 with the same name in <filename>/usr/lib/tmpfiles.d</filename> and
91 <filename>/run/tmpfiles.d</filename>. Files in
92 <filename>/run/tmpfiles.d</filename> override files with the same
93 name in <filename>/usr/lib/tmpfiles.d</filename>. Packages should
94 install their configuration files in
95 <filename>/usr/lib/tmpfiles.d</filename>. Files in
96 <filename>/etc/tmpfiles.d</filename> are reserved for the local
97 administrator, who may use this logic to override the
98 configuration files installed by vendor packages. All
99 configuration files are sorted by their filename in lexicographic
100 order, regardless of which of the directories they reside in. If
101 multiple files specify the same path, the entry in the file with
102 the lexicographically earliest name will be applied. All other
103 conflicting entries will be logged as errors. When two lines are
104 prefix and suffix of each other, then the prefix is always
6d785b6d
LP
105 processed first, the suffix later. Lines that take globs are
106 applied after those accepting no globs. If multiple operations
b938cb90
JE
107 shall be applied on the same file, (such as ACL, xattr, file
108 attribute adjustments), these are always done in the same fixed
6d785b6d
LP
109 order. Otherwise, the files/directories are processed in the order
110 they are listed.</para>
302fbdf2
ZJS
111
112 <para>If the administrator wants to disable a configuration file
113 supplied by the vendor, the recommended way is to place a symlink
114 to <filename>/dev/null</filename> in
115 <filename>/etc/tmpfiles.d/</filename> bearing the same filename.
116 </para>
8165be2e
ZJS
117 </refsect1>
118
119 <refsect1>
120 <title>Configuration File Format</title>
302fbdf2
ZJS
121
122 <para>The configuration format is one line per path containing
123 type, path, mode, ownership, age, and argument fields:</para>
124
125 <programlisting>#Type Path Mode UID GID Age Argument
ed7fd549
ZJS
126d /run/user 0755 root root 10d -
127L /tmp/foobar - - - - /dev/null</programlisting>
302fbdf2 128
657cf7f4 129 <para>Fields may be enclosed within quotes and contain C-style escapes.</para>
130
302fbdf2
ZJS
131 <refsect2>
132 <title>Type</title>
133
134 <para>The type consists of a single letter and optionally an
135 exclamation mark.</para>
136
137 <para>The following line types are understood:</para>
138
139 <variablelist>
140 <varlistentry>
141 <term><varname>f</varname></term>
142 <listitem><para>Create a file if it does not exist yet. If
143 the argument parameter is given, it will be written to the
6a9171d2 144 file. Does not follow symlinks.</para></listitem>
302fbdf2
ZJS
145 </varlistentry>
146
147 <varlistentry>
148 <term><varname>F</varname></term>
149 <listitem><para>Create or truncate a file. If the argument
6a9171d2 150 parameter is given, it will be written to the file. Does not follow symlinks.</para>
302fbdf2
ZJS
151 </listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><varname>w</varname></term>
156 <listitem><para>Write the argument parameter to a file, if
157 the file exists. Lines of this type accept shell-style
158 globs in place of normal path names. The argument parameter
159 will be written without a trailing newline. C-style
6a9171d2
LP
160 backslash escapes are interpreted. Follows
161 symlinks.</para></listitem>
302fbdf2
ZJS
162 </varlistentry>
163
164 <varlistentry>
165 <term><varname>d</varname></term>
4b743d67
ZJS
166 <listitem><para>Create a directory. The mode and ownership will be adjusted if
167 specified and the directory already exists. Contents of this directory are subject
ed7fd549 168 to time based cleanup if the age argument is specified.</para></listitem>
302fbdf2
ZJS
169 </varlistentry>
170
171 <varlistentry>
172 <term><varname>D</varname></term>
4b743d67
ZJS
173 <listitem><para>Similar to <varname>d</varname>, but in addition the contents
174 of the directory will be removed when <option>--remove</option> is used.
175 </para></listitem>
176 </varlistentry>
df8dee85
ZJS
177
178 <varlistentry>
179 <term><varname>e</varname></term>
ed7fd549
ZJS
180 <listitem><para>Similar to <varname>d</varname>, but the directory will not be created if
181 it does not exist. Lines of this type accept shell-style globs in place of normal path
182 names. For this entry to be useful, at least one of the mode, uid, gid, or age arguments
183 must be specified, since otherwise this entry has no effect. If the age argument is
184 <literal>0</literal>, contents of the directory will be unconditionally deleted every time
185 <command>systemd-tmpfiles --clean</command> is run. This can be useful when combined with
186 <varname>!</varname>, see the examples.</para></listitem>
302fbdf2
ZJS
187 </varlistentry>
188
189 <varlistentry>
190 <term><varname>v</varname></term>
191 <listitem><para>Create a subvolume if the path does not
2904e949
LP
192 exist yet, the file system supports subvolumes (btrfs), and
193 the system itself is installed into a subvolume
194 (specifically: the root directory <filename>/</filename> is
195 itself a subvolume). Otherwise, create a normal directory, in
196 the same way as <varname>d</varname>. A subvolume created
197 with this line type is not assigned to any higher-level
198 quota group. For that, use <varname>q</varname> or
199 <varname>Q</varname>, which allow creating simple quota
200 group hierarchies, see below.</para></listitem>
5fb13eb5
LP
201 </varlistentry>
202
203 <varlistentry>
204 <term><varname>q</varname></term>
b938cb90 205 <listitem><para>Similar to <varname>v</varname>. However,
5fb13eb5
LP
206 makes sure that the subvolume will be assigned to the same
207 higher-level quota groups as the subvolume it has been
208 created in. This ensures that higher-level limits and
209 accounting applied to the parent subvolume also include the
210 specified subvolume. On non-btrfs file systems, this line
211 type is identical to <varname>d</varname>. If the subvolume
212 already exists and is already assigned to one or more higher
b938cb90 213 level quota groups, no change to the quota hierarchy is
5fb13eb5
LP
214 made. Also see <varname>Q</varname> below. See <citerefentry
215 project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
216 for details about the btrfs quota group
217 concept.</para></listitem>
218 </varlistentry>
219
220 <varlistentry>
221 <term><varname>Q</varname></term>
b938cb90 222 <listitem><para>Similar to <varname>q</varname>. However,
5fb13eb5
LP
223 instead of copying the higher-level quota group assignments
224 from the parent as-is, the lowest quota group of the parent
225 subvolume is determined that is not the leaf quota
226 group. Then, an "intermediary" quota group is inserted that
227 is one level below this level, and shares the same ID part
228 as the specified subvolume. If no higher-level quota group
229 exists for the parent subvolume, a new quota group at level
230 255 sharing the same ID as the specified subvolume is
231 inserted instead. This new intermediary quota group is then
232 assigned to the parent subvolume's higher-level quota
233 groups, and the specified subvolume's leaf quota group is
234 assigned to it.</para>
235
236 <para>Effectively, this has a similar effect as
237 <varname>q</varname>, however introduces a new higher-level
238 quota group for the specified subvolume that may be used to
239 enforce limits and accounting to the specified subvolume and
240 children subvolume created within it. Thus, by creating
241 subvolumes only via <varname>q</varname> and
b938cb90 242 <varname>Q</varname>, a concept of "subtree quotas" is
5fb13eb5
LP
243 implemented. Each subvolume for which <varname>Q</varname>
244 is set will get a "subtree" quota group created, and all
245 child subvolumes created within it will be assigned to
246 it. Each subvolume for which <varname>q</varname> is set
247 will not get such a "subtree" quota group, but it is ensured
248 that they are added to the same "subtree" quota group as their
249 immediate parents.</para>
250
251 <para>It is recommended to use
252 <varname>Q</varname> for subvolumes that typically contain
253 further subvolumes, and where it is desirable to have
254 accounting and quota limits on all child subvolumes
255 together. Examples for <varname>Q</varname> are typically
256 <filename>/home</filename> or
257 <filename>/var/lib/machines</filename>. In contrast,
258 <varname>q</varname> should be used for subvolumes that
259 either usually do not include further subvolumes or where no
260 accounting and quota limits are needed that apply to all
261 child subvolumes together. Examples for <varname>q</varname>
262 are typically <filename>/var</filename> or
263 <filename>/var/tmp</filename>. As with <varname>Q</varname>,
264 <varname>q</varname> has no effect on the quota group
265 hierarchy if the subvolume exists and already has at least
266 one higher-level quota group assigned.</para></listitem>
302fbdf2
ZJS
267 </varlistentry>
268
269 <varlistentry>
270 <term><varname>p</varname></term>
271 <term><varname>p+</varname></term>
272 <listitem><para>Create a named pipe (FIFO) if it does not
273 exist yet. If suffixed with <varname>+</varname> and a file
274 already exists where the pipe is to be created, it will be
275 removed and be replaced by the pipe.</para></listitem>
276 </varlistentry>
277
278 <varlistentry>
279 <term><varname>L</varname></term>
280 <term><varname>L+</varname></term>
281 <listitem><para>Create a symlink if it does not exist
b3f5897f
WD
282 yet. If suffixed with <varname>+</varname> and a file or
283 directory already exists where the symlink is to be created,
284 it will be removed and be replaced by the symlink. If the
285 argument is omitted, symlinks to files with the same name
286 residing in the directory
287 <filename>/usr/share/factory/</filename> are created. Note
288 that permissions and ownership on symlinks are ignored.
289 </para></listitem>
302fbdf2
ZJS
290 </varlistentry>
291
292 <varlistentry>
293 <term><varname>c</varname></term>
294 <term><varname>c+</varname></term>
295 <listitem><para>Create a character device node if it does
296 not exist yet. If suffixed with <varname>+</varname> and a
297 file already exists where the device node is to be created,
298 it will be removed and be replaced by the device node. It is
299 recommended to suffix this entry with an exclamation mark to
300 only create static device nodes at boot, as udev will not
301 manage static device nodes that are created at runtime.
302 </para></listitem>
303 </varlistentry>
304
305 <varlistentry>
306 <term><varname>b</varname></term>
307 <term><varname>b+</varname></term>
308 <listitem><para>Create a block device node if it does not
309 exist yet. If suffixed with <varname>+</varname> and a file
310 already exists where the device node is to be created, it
311 will be removed and be replaced by the device node. It is
312 recommended to suffix this entry with an exclamation mark to
313 only create static device nodes at boot, as udev will not
314 manage static device nodes that are created at runtime.
315 </para></listitem>
316 </varlistentry>
317
318 <varlistentry>
319 <term><varname>C</varname></term>
320 <listitem><para>Recursively copy a file or directory, if the
321 destination files or directories do not exist yet. Note that
322 this command will not descend into subdirectories if the
323 destination directory already exists. Instead, the entire
324 copy operation is skipped. If the argument is omitted, files
325 from the source directory
326 <filename>/usr/share/factory/</filename> with the same name
6a9171d2 327 are copied. Does not follow symlinks.</para></listitem>
302fbdf2
ZJS
328 </varlistentry>
329
330 <varlistentry>
331 <term><varname>x</varname></term>
332 <listitem><para>Ignore a path during cleaning. Use this type
333 to exclude paths from clean-up as controlled with the Age
334 parameter. Note that lines of this type do not influence the
335 effect of <varname>r</varname> or <varname>R</varname>
50d9e46d 336 lines. Lines of this type accept shell-style globs in place
302fbdf2
ZJS
337 of normal path names. </para></listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><varname>X</varname></term>
342 <listitem><para>Ignore a path during cleaning. Use this type
343 to exclude paths from clean-up as controlled with the Age
344 parameter. Unlike <varname>x</varname>, this parameter will
345 not exclude the content if path is a directory, but only
346 directory itself. Note that lines of this type do not
347 influence the effect of <varname>r</varname> or
50d9e46d 348 <varname>R</varname> lines. Lines of this type accept
302fbdf2
ZJS
349 shell-style globs in place of normal path names.
350 </para></listitem>
351 </varlistentry>
352
353 <varlistentry>
354 <term><varname>r</varname></term>
355 <listitem><para>Remove a file or directory if it exists.
356 This may not be used to remove non-empty directories, use
357 <varname>R</varname> for that. Lines of this type accept
358 shell-style globs in place of normal path
6a9171d2 359 names. Does not follow symlinks.</para></listitem>
302fbdf2
ZJS
360 </varlistentry>
361
362 <varlistentry>
363 <term><varname>R</varname></term>
364 <listitem><para>Recursively remove a path and all its
365 subdirectories (if it is a directory). Lines of this type
366 accept shell-style globs in place of normal path
6a9171d2 367 names. Does not follow symlinks.</para></listitem>
302fbdf2
ZJS
368 </varlistentry>
369
370 <varlistentry>
371 <term><varname>z</varname></term>
372 <listitem><para>Adjust the access mode, group and user, and
373 restore the SELinux security context of a file or directory,
374 if it exists. Lines of this type accept shell-style globs in
6a9171d2 375 place of normal path names. Does not follow symlinks.</para></listitem>
302fbdf2
ZJS
376 </varlistentry>
377
378 <varlistentry>
379 <term><varname>Z</varname></term>
380 <listitem><para>Recursively set the access mode, group and
381 user, and restore the SELinux security context of a file or
382 directory if it exists, as well as of its subdirectories and
383 the files contained therein (if applicable). Lines of this
6a9171d2
LP
384 type accept shell-style globs in place of normal path
385 names. Does not follow symlinks. </para></listitem>
302fbdf2
ZJS
386 </varlistentry>
387
388 <varlistentry>
389 <term><varname>t</varname></term>
b705ab6a
ZJS
390 <listitem><para>Set extended attributes. Lines of this type
391 accept shell-style globs in place of normal path names.
6a9171d2
LP
392 This can be useful for setting SMACK labels. Does not follow
393 symlinks.</para></listitem>
b705ab6a
ZJS
394 </varlistentry>
395
396 <varlistentry>
397 <term><varname>T</varname></term>
398 <listitem><para>Recursively set extended attributes. Lines
399 of this type accept shell-style globs in place of normal
6a9171d2
LP
400 path names. This can be useful for setting SMACK
401 labels. Does not follow symlinks. </para></listitem>
302fbdf2 402 </varlistentry>
f8eeeaf9 403
fa3f5fd2
GB
404 <varlistentry>
405 <term><varname>h</varname></term>
406 <listitem><para>Set file/directory attributes. Lines of this type
407 accept shell-style globs in place of normal path names.</para>
408
1ae705fb
LP
409 <para>The format of the argument field is
410 <varname>[+-=][aAcCdDeijsStTu] </varname>. The prefix
411 <varname>+</varname> (the default one) causes the
fa3f5fd2 412 attribute(s) to be added; <varname>-</varname> causes the
1ae705fb 413 attribute(s) to be removed; <varname>=</varname> causes the
a8eaaee7 414 attributes to be set exactly as the following letters. The
1ae705fb 415 letters <literal>aAcCdDeijsStTu</literal> select the new
fa3f5fd2 416 attributes for the files, see
c30c611c 417 <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle>
fa3f5fd2
GB
418 <manvolnum>1</manvolnum></citerefentry> for further information.
419 </para>
1ae705fb
LP
420 <para>Passing only <varname>=</varname> as argument resets
421 all the file attributes listed above. It has to be pointed
b938cb90 422 out that the <varname>=</varname> prefix limits itself to
1ae705fb
LP
423 the attributes corresponding to the letters listed here. All
424 other attributes will be left untouched. Does not follow
425 symlinks.</para>
fa3f5fd2
GB
426 </listitem>
427 </varlistentry>
428
429 <varlistentry>
430 <term><varname>H</varname></term>
431 <listitem><para>Recursively set file/directory attributes. Lines
432 of this type accept shell-style globs in place of normal
6a9171d2 433 path names. Does not follow symlinks.
fa3f5fd2
GB
434 </para></listitem>
435 </varlistentry>
436
f8eeeaf9
ZJS
437 <varlistentry>
438 <term><varname>a</varname></term>
50d9e46d
ZJS
439 <term><varname>a+</varname></term>
440 <listitem><para>Set POSIX ACLs (access control lists). If
a8eaaee7 441 suffixed with <varname>+</varname>, the specified entries will
dd4105b0
ZJS
442 be added to the existing set.
443 <command>systemd-tmpfiles</command> will automatically add
444 the required base entries for user and group based on the
445 access mode of the file, unless base entries already exist
7f3fdb7f 446 or are explicitly specified. The mask will be added if not
dd4105b0
ZJS
447 specified explicitly or already present. Lines of this type
448 accept shell-style globs in place of normal path names. This
449 can be useful for allowing additional access to certain
6a9171d2 450 files. Does not follow symlinks.</para></listitem>
b705ab6a
ZJS
451 </varlistentry>
452
453 <varlistentry>
454 <term><varname>A</varname></term>
50d9e46d
ZJS
455 <term><varname>A+</varname></term>
456 <listitem><para>Same as <varname>a</varname> and
6a9171d2
LP
457 <varname>a+</varname>, but recursive. Does not follow
458 symlinks.</para></listitem>
f8eeeaf9 459 </varlistentry>
302fbdf2
ZJS
460 </variablelist>
461
462 <para>If the exclamation mark is used, this line is only safe of
463 execute during boot, and can break a running system. Lines
464 without the exclamation mark are presumed to be safe to execute
465 at any time, e.g. on package upgrades.
466 <command>systemd-tmpfiles</command> will execute line with an
467 exclamation mark only if option <option>--boot</option> is
468 given.</para>
469
470 <para>For example:
471 <programlisting># Make sure these are created by default so that nobody else can
9b9c30ec 472d /tmp/.X11-unix 1777 root root 10d
302fbdf2 473
9b9c30ec
LP
474# Unlink the X11 lock files
475r! /tmp/.X[0-9]*-lock</programlisting>
302fbdf2
ZJS
476 The second line in contrast to the first one would break a
477 running system, and will only be executed with
478 <option>--boot</option>.</para>
479 </refsect2>
480
481 <refsect2>
482 <title>Path</title>
483
484 <para>The file system path specification supports simple
2df36d09
ZJS
485 specifier expansion, see below. The path (after expansion) must be
486 absolute.</para>
302fbdf2
ZJS
487 </refsect2>
488
489 <refsect2>
490 <title>Mode</title>
491
492 <para>The file access mode to use when creating this file or
493 directory. If omitted or when set to <literal>-</literal>, the
494 default is used: 0755 for directories, 0644 for all other file
495 objects. For <varname>z</varname>, <varname>Z</varname> lines,
496 if omitted or when set to <literal>-</literal>, the file access
497 mode will not be modified. This parameter is ignored for
498 <varname>x</varname>, <varname>r</varname>,
f8eeeaf9
ZJS
499 <varname>R</varname>, <varname>L</varname>, <varname>t</varname>,
500 and <varname>a</varname> lines.</para>
302fbdf2
ZJS
501
502 <para>Optionally, if prefixed with <literal>~</literal>, the
503 access mode is masked based on the already set access bits for
504 existing file or directories: if the existing file has all
505 executable bits unset, all executable bits are removed from the
506 new access mode, too. Similarly, if all read bits are removed
507 from the old access mode, they will be removed from the new
508 access mode too, and if all write bits are removed, they will be
509 removed from the new access mode too. In addition, the
510 sticky/SUID/SGID bit is removed unless applied to a
511 directory. This functionality is particularly useful in
512 conjunction with <varname>Z</varname>.</para>
513 </refsect2>
514
515 <refsect2>
516 <title>UID, GID</title>
517
518 <para>The user and group to use for this file or directory. This
519 may either be a numeric user/group ID or a user or group
520 name. If omitted or when set to <literal>-</literal>, the
a8eaaee7 521 default 0 (root) is used. For <varname>z</varname> and
f8eeeaf9
ZJS
522 <varname>Z</varname> lines, when omitted or when set to
523 <literal>-</literal>, the file ownership will not be
524 modified. These parameters are ignored for <varname>x</varname>,
525 <varname>r</varname>, <varname>R</varname>,
526 <varname>L</varname>, <varname>t</varname>, and
527 <varname>a</varname> lines.</para>
302fbdf2
ZJS
528 </refsect2>
529
530 <refsect2>
531 <title>Age</title>
532 <para>The date field, when set, is used to decide what files to
533 delete when cleaning. If a file or directory is older than the
534 current time minus the age field, it is deleted. The field
535 format is a series of integers each followed by one of the
a8eaaee7 536 following suffixes for the respective time units:
00c53f42
ZJS
537 <constant>s</constant>,
538 <constant>m</constant> or <constant>min</constant>,
539 <constant>h</constant>,
540 <constant>d</constant>,
541 <constant>w</constant>,
a8eaaee7 542 <constant>ms</constant>, and
00c53f42 543 <constant>us</constant>,
a8eaaee7
JE
544 meaning seconds, minutes, hours, days, weeks,
545 milliseconds, and microseconds, respectively. Full names of the time units can
00c53f42
ZJS
546 be used too.
547 </para>
302fbdf2
ZJS
548
549 <para>If multiple integers and units are specified, the time
00c53f42
ZJS
550 values are summed. If an integer is given without a unit,
551 <constant>s</constant> is assumed.
302fbdf2
ZJS
552 </para>
553
554 <para>When the age is set to zero, the files are cleaned
555 unconditionally.</para>
556
5fb13eb5 557 <para>The age field only applies to lines starting with
df8dee85 558 <varname>d</varname>, <varname>D</varname>, <varname>e</varname>,
5fb13eb5
LP
559 <varname>v</varname>, <varname>q</varname>,
560 <varname>Q</varname>, <varname>C</varname>, <varname>x</varname>
561 and <varname>X</varname>. If omitted or set to
562 <literal>-</literal>, no automatic clean-up is done.</para>
302fbdf2
ZJS
563
564 <para>If the age field starts with a tilde character
565 <literal>~</literal>, the clean-up is only applied to files and
566 directories one level inside the directory specified, but not
567 the files and directories immediately inside it.</para>
568 </refsect2>
569
570 <refsect2>
571 <title>Argument</title>
572
573 <para>For <varname>L</varname> lines determines the destination
a8eaaee7
JE
574 path of the symlink. For <varname>c</varname> and
575 <varname>b</varname>, determines the major/minor of the device
302fbdf2
ZJS
576 node, with major and minor formatted as integers, separated by
577 <literal>:</literal>, e.g. <literal>1:3</literal>. For
578 <varname>f</varname>, <varname>F</varname>, and
a8eaaee7 579 <varname>w</varname>, the argument may be used to specify a short string that
302fbdf2
ZJS
580 is written to the file, suffixed by a newline. For
581 <varname>C</varname>, specifies the source file or
a8eaaee7 582 directory. For <varname>t</varname> and <varname>T</varname>,
0ac0b1e7 583 determines extended attributes to be set. For
a8eaaee7
JE
584 <varname>a</varname> and <varname>A</varname>, determines ACL
585 attributes to be set. For <varname>h</varname> and
b938cb90 586 <varname>H</varname>, determines the file attributes to
0ac0b1e7 587 set. Ignored for all other lines.</para>
2df36d09
ZJS
588
589 <para>This field can contain specifiers, see below.</para>
302fbdf2 590 </refsect2>
2df36d09 591 </refsect1>
302fbdf2 592
2df36d09
ZJS
593 <refsect1>
594 <title>Specifiers</title>
595
596 <para>Specifiers can be used in the "path" and "argument" fields.
597 The following expansions are understood:</para>
598 <table>
599 <title>Specifiers available</title>
600 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
601 <colspec colname="spec" />
602 <colspec colname="mean" />
603 <colspec colname="detail" />
604 <thead>
605 <row>
606 <entry>Specifier</entry>
607 <entry>Meaning</entry>
608 <entry>Details</entry>
609 </row>
610 </thead>
611 <tbody>
612 <row>
613 <entry><literal>%m</literal></entry>
614 <entry>Machine ID</entry>
615 <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>
616 </row>
617 <row>
618 <entry><literal>%b</literal></entry>
619 <entry>Boot ID</entry>
620 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
621 </row>
622 <row>
623 <entry><literal>%H</literal></entry>
624 <entry>Host name</entry>
625 <entry>The hostname of the running system.</entry>
626 </row>
627 <row>
628 <entry><literal>%v</literal></entry>
629 <entry>Kernel release</entry>
630 <entry>Identical to <command>uname -r</command> output.</entry>
631 </row>
632 <row>
633 <entry><literal>%%</literal></entry>
634 <entry>Escaped %</entry>
635 <entry>Single percent sign.</entry>
636 </row>
637 </tbody>
638 </tgroup>
639 </table>
302fbdf2
ZJS
640 </refsect1>
641
642 <refsect1>
4b743d67 643 <title>Examples</title>
302fbdf2 644 <example>
4b743d67
ZJS
645 <title>Create directories with specific mode and ownership</title>
646 <para>
0a07667d 647 <citerefentry project='die-net'><refentrytitle>screen</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4b743d67
ZJS
648 needs two directories created at boot with specific modes and ownership:</para>
649
650 <programlisting># /usr/lib/tmpfiles.d/screen.conf
651d /run/screens 1777 root screen 10d
652d /run/uscreens 0755 root screen 10d12h
653</programlisting>
654
655 <para>Contents of <filename>/run/screens</filename> and /run/uscreens will
656 cleaned up after 10 and 10½ days, respectively.</para>
657 </example>
302fbdf2 658
4b743d67
ZJS
659 <example>
660 <title>Create a directory with a SMACK attribute</title>
661 <programlisting>D /run/cups - - - -
662t /run/cups - - - - security.SMACK64=printing user.attr-with-spaces="foo bar"
663 </programlisting>
664
b17649ee 665 <para>The directory will be owned by root and have default mode. Its contents are
4b743d67
ZJS
666 not subject to time based cleanup, but will be obliterated when
667 <command>systemd-tmpfiles --remove</command> runs.</para>
302fbdf2 668 </example>
4b743d67 669
302fbdf2 670 <example>
4b743d67
ZJS
671 <title>Create a directory and prevent its contents from cleanup</title>
672 <para>
0a07667d 673 <citerefentry project='die-net'><refentrytitle>abrt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4b743d67
ZJS
674 needs a directory created at boot with specific mode and ownership and its content
675 should be preserved from the automatic cleanup applied to the contents of
676 <filename>/var/tmp</filename>:</para>
677
678 <programlisting># /usr/lib/tmpfiles.d/tmp.conf
679d /var/tmp 1777 root root 30d
680</programlisting>
681
682 <programlisting># /usr/lib/tmpfiles.d/abrt.conf
683d /var/tmp/abrt 0755 abrt abrt -
df8dee85
ZJS
684</programlisting>
685 </example>
686
687 <example>
688 <title>Apply clean up during boot and based on time</title>
689
690 <programlisting># /usr/lib/tmpfiles.d/dnf.conf
691r! /var/cache/dnf/*/*/download_lock.pid
692r! /var/cache/dnf/*/*/metadata_lock.pid
693r! /var/lib/dnf/rpmdb_lock.pid
e80f1a79 694e /var/cache/dnf/ - - - 30d
4b743d67 695</programlisting>
302fbdf2 696
df8dee85 697 <para>The lock files will be removed during boot. Any files and directories in
e80f1a79 698 <filename>/var/cache/dnf/</filename> will be removed after they have not been
df8dee85 699 accessed in 30 days.</para>
302fbdf2 700 </example>
ed7fd549
ZJS
701
702 <example>
b719b26c 703 <title>Empty the contents of a cache directory on boot</title>
ed7fd549
ZJS
704
705 <programlisting># /usr/lib/tmpfiles.d/krb5rcache.conf
706e! /var/cache/krb5rcache - - - 0
707</programlisting>
708
709 <para>Any files and subdirectories in <filename>/var/cache/krb5rcache/</filename>
710 will be removed on boot. The directory will not be created.
711 </para>
712 </example>
302fbdf2
ZJS
713 </refsect1>
714
715 <refsect1>
716 <title>See Also</title>
717 <para>
718 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
719 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
720 <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f8eeeaf9
ZJS
721 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
722 <citerefentry project='man-pages'><refentrytitle>attr</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
723 <citerefentry project='man-pages'><refentrytitle>getfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
724 <citerefentry project='man-pages'><refentrytitle>setfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
725 <citerefentry project='man-pages'><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
fa3f5fd2 726 <citerefentry project='man-pages'><refentrytitle>getfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
5fb13eb5
LP
727 <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
728 <citerefentry project='die-net'><refentrytitle>btrfs-subvolume</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
729 <citerefentry project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
302fbdf2
ZJS
730 </para>
731 </refsect1>
4149f86d
BP
732
733</refentry>