]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/tmpfiles.d.xml
journalctl: add a marker to log output for reboots
[thirdparty/systemd.git] / man / tmpfiles.d.xml
CommitLineData
4149f86d
BP
1<?xml version="1.0"?>
2<!--*-nxml-*-->
3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!--
5 This file is part of systemd.
6
7 Copyright 2010 Brandon Philips
8
9 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
4149f86d
BP
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 17 Lesser General Public License for more details.
4149f86d 18
5430f7f2 19 You should have received a copy of the GNU Lesser General Public License
4149f86d
BP
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21-->
22<refentry id="tmpfiles.d">
23
24 <refentryinfo>
25 <title>tmpfiles.d</title>
26 <productname>systemd</productname>
27
28 <authorgroup>
29 <author>
30 <contrib>Documentation</contrib>
31 <firstname>Brandon</firstname>
32 <surname>Philips</surname>
33 <email>brandon@ifup.org</email>
34 </author>
35 </authorgroup>
36 </refentryinfo>
37
38 <refmeta>
39 <refentrytitle>tmpfiles.d</refentrytitle>
40 <manvolnum>5</manvolnum>
41 </refmeta>
42
43 <refnamediv>
44 <refname>tmpfiles.d</refname>
522d4a49
LP
45 <refpurpose>Configuration for creation, deletion and
46 cleaning of volatile and temporary files</refpurpose>
4149f86d
BP
47 </refnamediv>
48
a7c64469
LP
49 <refsynopsisdiv>
50 <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
772f8371 51 <para><filename>/run/tmpfiles.d/*.conf</filename></para>
fc1a2e06 52 <para><filename>/usr/lib/tmpfiles.d/*.conf</filename></para>
a7c64469
LP
53 </refsynopsisdiv>
54
4149f86d
BP
55 <refsect1>
56 <title>Description</title>
57
0e25e94e
KS
58 <para><command>systemd-tmpfiles</command> uses the
59 configuration files from the above directories to describe the
60 creation, cleaning and removal of volatile and
61 temporary files and directories which usually reside
62 in directories such as <filename>/run</filename>
63 or <filename>/tmp</filename>.</para>
4149f86d
BP
64 </refsect1>
65
66 <refsect1>
0e25e94e 67 <title>Configuration Format</title>
4149f86d 68
6110885c
KS
69 <para>Each configuration file shall be named in the
70 style of <filename>&lt;program&gt;.conf</filename>.
71 Files in <filename>/etc/</filename> override files
72 with the same name in <filename>/usr/lib/</filename>
73 and <filename>/run/</filename>. Files in
74 <filename>/run/</filename> override files with the same
75 name in <filename>/usr/lib/</filename>. Packages
76 should install their configuration files in
77 <filename>/usr/lib/</filename>. Files in
468d726b 78 <filename>/etc/</filename> are reserved for the local
6110885c
KS
79 administrator, who may use this logic to override the
80 configuration files installed by vendor packages. All
468d726b
LP
81 configuration files are sorted by their filename in
82 alphabetical order, regardless in which of the
6110885c
KS
83 directories they reside, to guarantee that a specific
84 configuration file takes precedence over another file
15324492 85 with an alphabetically later name.</para>
6110885c
KS
86
87 <para>If the administrator wants to disable a
88 configuration file supplied by the vendor the
89 recommended way is to place a symlink to
90 <filename>/dev/null</filename> in
91 <filename>/etc/tmpfiles.d/</filename> bearing the
92 same file name.</para>
772f8371 93
0e25e94e
KS
94 <para>The configuration format is one line per path
95 containing action, path, mode, ownership, age and argument
96 fields:</para>
aeee2322 97
468d726b
LP
98 <programlisting>Type Path Mode UID GID Age Argument
99d /run/user 0755 root root 10d -
100L /tmp/foobar - - - - /dev/null</programlisting>
aeee2322
LP
101
102 <refsect2>
88aebb62 103 <title>Type</title>
aeee2322
LP
104 <variablelist>
105 <varlistentry>
106 <term><varname>f</varname></term>
31ed59c5 107 <listitem><para>Create a file if it doesn't exist yet (optionally writing a short string into it, if the argument parameter is passed)</para></listitem>
aeee2322
LP
108 </varlistentry>
109
110 <varlistentry>
111 <term><varname>F</varname></term>
31ed59c5
LP
112 <listitem><para>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</para></listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><varname>w</varname></term>
117 <listitem><para>Write the argument parameter to a file, if it exists.</para></listitem>
aeee2322
LP
118 </varlistentry>
119
120 <varlistentry>
121 <term><varname>d</varname></term>
a7c64469 122 <listitem><para>Create a directory if it doesn't exist yet</para></listitem>
aeee2322
LP
123 </varlistentry>
124
125 <varlistentry>
126 <term><varname>D</varname></term>
a7c64469 127 <listitem><para>Create or empty a directory</para></listitem>
aeee2322
LP
128 </varlistentry>
129
ee17ee7c
LP
130 <varlistentry>
131 <term><varname>p</varname></term>
132 <listitem><para>Create a named pipe (FIFO) if it doesn't exist yet</para></listitem>
133 </varlistentry>
134
468d726b
LP
135 <varlistentry>
136 <term><varname>L</varname></term>
137 <listitem><para>Create a symlink if it doesn't exist yet</para></listitem>
138 </varlistentry>
139
140 <varlistentry>
141 <term><varname>c</varname></term>
142 <listitem><para>Create a character device node if it doesn't exist yet</para></listitem>
143 </varlistentry>
144
145 <varlistentry>
146 <term><varname>b</varname></term>
147 <listitem><para>Create a block device node if it doesn't exist yet</para></listitem>
148 </varlistentry>
149
aeee2322
LP
150 <varlistentry>
151 <term><varname>x</varname></term>
b8bb3e8f
LP
152 <listitem><para>Ignore a path
153 during cleaning. Use this type
154 to exclude paths from clean-up
155 as controlled with the Age
156 parameter. Note that lines of
157 this type do not influence the
158 effect of r or R lines. Lines
159 of this type accept
160 shell-style globs in place of
161 of normal path
162 names.</para></listitem>
aeee2322
LP
163 </varlistentry>
164
165 <varlistentry>
166 <term><varname>r</varname></term>
b8bb3e8f
LP
167 <listitem><para>Remove a file
168 or directory if it
169 exists. This may not be used
170 to remove non-empty
171 directories, use R for
172 that. Lines of this type
173 accept shell-style globs in
174 place of normal path
175 names.</para></listitem>
aeee2322
LP
176 </varlistentry>
177
178 <varlistentry>
179 <term><varname>R</varname></term>
b8bb3e8f
LP
180 <listitem><para>Recursively
181 remove a path and all its
182 subdirectories (if it is a
183 directory). Lines of this type
184 accept shell-style globs in
185 place of normal path
186 names.</para></listitem>
aeee2322 187 </varlistentry>
462d63db 188
777b87e7
MS
189 <varlistentry>
190 <term><varname>z</varname></term>
669e49fe
LP
191 <listitem><para>Restore
192 SELinux security context label
193 and set ownership and access
194 mode of a file or directory if
195 it exists. Lines of this type
196 accept shell-style globs in
197 place of normal path names.
777b87e7
MS
198 </para></listitem>
199 </varlistentry>
200
462d63db
MS
201 <varlistentry>
202 <term><varname>Z</varname></term>
669e49fe
LP
203 <listitem><para>Recursively
204 restore SELinux security
205 context label and set
206 ownership and access mode of a
207 path and all its
208 subdirectories (if it is a
209 directory). Lines of this type
210 accept shell-style globs in
211 place of normal path
212 names.</para></listitem>
462d63db 213 </varlistentry>
aeee2322
LP
214 </variablelist>
215 </refsect2>
216
217 <refsect2>
88aebb62
LP
218 <title>Mode</title>
219
b8bb3e8f
LP
220 <para>The file access mode to use when
221 creating this file or directory. If omitted or
222 when set to - the default is used: 0755 for
468d726b
LP
223 directories, 0644 for all other file
224 objects. For z, Z lines if omitted or when set
225 to - the file access mode will not be
226 modified. This parameter is ignored for x, r,
227 R, L lines.</para>
88aebb62
LP
228 </refsect2>
229
230 <refsect2>
231 <title>UID, GID</title>
232
233 <para>The user and group to use for this file
234 or directory. This may either be a numeric
235 user/group ID or a user or group name. If
b8bb3e8f 236 omitted or when set to - the default 0 (root)
777b87e7 237 is used. For z, Z lines when omitted or when set to -
062e01bb 238 the file ownership will not be modified.
468d726b 239 These parameters are ignored for x, r, R, L lines.</para>
88aebb62
LP
240 </refsect2>
241
242 <refsect2>
243 <title>Age</title>
aeee2322
LP
244 <para>The date field, when set, is used to
245 decide what files to delete when cleaning. If
246 a file or directory is older than the current
247 time minus the age field it is deleted. The
248 field format is a series of integers each
249 followed by one of the following
250 postfixes for the respective time units:</para>
251
252 <variablelist>
253 <varlistentry>
254 <term><varname>s</varname></term>
255 <term><varname>min</varname></term>
256 <term><varname>h</varname></term>
257 <term><varname>d</varname></term>
258 <term><varname>w</varname></term>
259 <term><varname>ms</varname></term>
260 <term><varname>m</varname></term>
261 <term><varname>us</varname></term></varlistentry>
262 </variablelist>
4149f86d 263
772f8371
KS
264 <para>If multiple integers and units are specified the time
265 values are summed up.</para>
4149f86d 266
772f8371
KS
267 <para>The age field only applies to lines starting with
268 d, D and x. If omitted or set to - no automatic clean-up
269 is done.</para>
24f3a374
LP
270
271 <para>If the age field starts with a tilde
272 character (~) the clean-up is only applied to
273 files and directories one level inside the
274 directory specified, but not the files and
275 directories immediately inside it.</para>
aeee2322 276 </refsect2>
4149f86d 277
468d726b
LP
278 <refsect2>
279 <title>Argument</title>
280
281 <para>For L lines determines the destination
282 path of the symlink. For c, b determines the
283 major/minor of the device node, with major and
284 minor formatted as integers, separated by :,
31ed59c5
LP
285 e.g. "1:3". For f, F, w may be used to specify
286 a short string that is written to the file,
287 suffixed by a newline. Ignored for all other
288 lines.</para>
468d726b
LP
289 </refsect2>
290
4149f86d
BP
291 </refsect1>
292
293 <refsect1>
294 <title>Example</title>
295 <example>
296 <title>/etc/tmpfiles.d/screen.conf example</title>
297 <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
298
468d726b 299 <programlisting>d /var/run/screens 1777 root root 10d
aeee2322 300d /var/run/uscreens 0755 root root 10d12h</programlisting>
4149f86d
BP
301 </example>
302 </refsect1>
303
304 <refsect1>
305 <title>See Also</title>
306 <para>
522d4a49 307 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
75945bad
LP
308 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
309 <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>
4149f86d
BP
310 </para>
311 </refsect1>
312
313</refentry>