]>
Commit | Line | Data |
---|---|---|
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><program>.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 |
99 | d /run/user 0755 root root 10d - | |
100 | L /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> | |
54693d9b DR |
117 | <listitem><para>Write the argument parameter to a file, if the file exists. |
118 | Lines of this type accept shell-style globs in place of normal path | |
119 | names. The argument parameter will be written without a trailing | |
120 | newline. C-style backslash escapes are interpreted.</para></listitem> | |
aeee2322 LP |
121 | </varlistentry> |
122 | ||
123 | <varlistentry> | |
124 | <term><varname>d</varname></term> | |
a7c64469 | 125 | <listitem><para>Create a directory if it doesn't exist yet</para></listitem> |
aeee2322 LP |
126 | </varlistentry> |
127 | ||
128 | <varlistentry> | |
129 | <term><varname>D</varname></term> | |
a7c64469 | 130 | <listitem><para>Create or empty a directory</para></listitem> |
aeee2322 LP |
131 | </varlistentry> |
132 | ||
ee17ee7c LP |
133 | <varlistentry> |
134 | <term><varname>p</varname></term> | |
135 | <listitem><para>Create a named pipe (FIFO) if it doesn't exist yet</para></listitem> | |
136 | </varlistentry> | |
137 | ||
468d726b LP |
138 | <varlistentry> |
139 | <term><varname>L</varname></term> | |
140 | <listitem><para>Create a symlink if it doesn't exist yet</para></listitem> | |
141 | </varlistentry> | |
142 | ||
143 | <varlistentry> | |
144 | <term><varname>c</varname></term> | |
145 | <listitem><para>Create a character device node if it doesn't exist yet</para></listitem> | |
146 | </varlistentry> | |
147 | ||
148 | <varlistentry> | |
149 | <term><varname>b</varname></term> | |
150 | <listitem><para>Create a block device node if it doesn't exist yet</para></listitem> | |
151 | </varlistentry> | |
152 | ||
aeee2322 LP |
153 | <varlistentry> |
154 | <term><varname>x</varname></term> | |
b8bb3e8f LP |
155 | <listitem><para>Ignore a path |
156 | during cleaning. Use this type | |
157 | to exclude paths from clean-up | |
158 | as controlled with the Age | |
159 | parameter. Note that lines of | |
160 | this type do not influence the | |
161 | effect of r or R lines. Lines | |
162 | of this type accept | |
163 | shell-style globs in place of | |
bb31a4ac | 164 | normal path |
b8bb3e8f | 165 | names.</para></listitem> |
aeee2322 LP |
166 | </varlistentry> |
167 | ||
78a92a5a MS |
168 | <varlistentry> |
169 | <term><varname>X</varname></term> | |
170 | <listitem><para>Ignore a path | |
171 | during cleanup. Use this type | |
172 | to prevent path removal as | |
173 | controlled with the Age parameter. | |
174 | Note that if path is a directory, | |
175 | content of a directory is not | |
176 | excluded from clean-up, only | |
177 | directory itself. Lines of this | |
178 | type accept shell-style globs | |
179 | in place of normal path | |
180 | names.</para></listitem> | |
181 | </varlistentry> | |
182 | ||
aeee2322 LP |
183 | <varlistentry> |
184 | <term><varname>r</varname></term> | |
b8bb3e8f LP |
185 | <listitem><para>Remove a file |
186 | or directory if it | |
187 | exists. This may not be used | |
188 | to remove non-empty | |
189 | directories, use R for | |
190 | that. Lines of this type | |
191 | accept shell-style globs in | |
192 | place of normal path | |
193 | names.</para></listitem> | |
aeee2322 LP |
194 | </varlistentry> |
195 | ||
196 | <varlistentry> | |
197 | <term><varname>R</varname></term> | |
b8bb3e8f LP |
198 | <listitem><para>Recursively |
199 | remove a path and all its | |
200 | subdirectories (if it is a | |
201 | directory). Lines of this type | |
202 | accept shell-style globs in | |
203 | place of normal path | |
204 | names.</para></listitem> | |
aeee2322 | 205 | </varlistentry> |
462d63db | 206 | |
777b87e7 MS |
207 | <varlistentry> |
208 | <term><varname>z</varname></term> | |
669e49fe LP |
209 | <listitem><para>Restore |
210 | SELinux security context label | |
211 | and set ownership and access | |
212 | mode of a file or directory if | |
213 | it exists. Lines of this type | |
214 | accept shell-style globs in | |
215 | place of normal path names. | |
777b87e7 MS |
216 | </para></listitem> |
217 | </varlistentry> | |
218 | ||
462d63db MS |
219 | <varlistentry> |
220 | <term><varname>Z</varname></term> | |
669e49fe LP |
221 | <listitem><para>Recursively |
222 | restore SELinux security | |
223 | context label and set | |
224 | ownership and access mode of a | |
225 | path and all its | |
226 | subdirectories (if it is a | |
227 | directory). Lines of this type | |
228 | accept shell-style globs in | |
229 | place of normal path | |
230 | names.</para></listitem> | |
462d63db | 231 | </varlistentry> |
aeee2322 LP |
232 | </variablelist> |
233 | </refsect2> | |
234 | ||
235 | <refsect2> | |
88aebb62 LP |
236 | <title>Mode</title> |
237 | ||
b8bb3e8f LP |
238 | <para>The file access mode to use when |
239 | creating this file or directory. If omitted or | |
240 | when set to - the default is used: 0755 for | |
468d726b LP |
241 | directories, 0644 for all other file |
242 | objects. For z, Z lines if omitted or when set | |
243 | to - the file access mode will not be | |
244 | modified. This parameter is ignored for x, r, | |
245 | R, L lines.</para> | |
88aebb62 LP |
246 | </refsect2> |
247 | ||
248 | <refsect2> | |
249 | <title>UID, GID</title> | |
250 | ||
251 | <para>The user and group to use for this file | |
252 | or directory. This may either be a numeric | |
253 | user/group ID or a user or group name. If | |
b8bb3e8f | 254 | omitted or when set to - the default 0 (root) |
777b87e7 | 255 | is used. For z, Z lines when omitted or when set to - |
062e01bb | 256 | the file ownership will not be modified. |
468d726b | 257 | These parameters are ignored for x, r, R, L lines.</para> |
88aebb62 LP |
258 | </refsect2> |
259 | ||
260 | <refsect2> | |
261 | <title>Age</title> | |
aeee2322 LP |
262 | <para>The date field, when set, is used to |
263 | decide what files to delete when cleaning. If | |
264 | a file or directory is older than the current | |
265 | time minus the age field it is deleted. The | |
266 | field format is a series of integers each | |
267 | followed by one of the following | |
268 | postfixes for the respective time units:</para> | |
269 | ||
270 | <variablelist> | |
271 | <varlistentry> | |
272 | <term><varname>s</varname></term> | |
273 | <term><varname>min</varname></term> | |
274 | <term><varname>h</varname></term> | |
275 | <term><varname>d</varname></term> | |
276 | <term><varname>w</varname></term> | |
277 | <term><varname>ms</varname></term> | |
278 | <term><varname>m</varname></term> | |
279 | <term><varname>us</varname></term></varlistentry> | |
280 | </variablelist> | |
4149f86d | 281 | |
772f8371 | 282 | <para>If multiple integers and units are specified the time |
ef44ed4e | 283 | values are summed up. If an integer is given without a unit, |
a2558205 TG |
284 | s is assumed. |
285 | </para> | |
286 | ||
287 | <para>When the age is set to zero, the files are cleaned | |
288 | unconditionally.</para> | |
4149f86d | 289 | |
772f8371 KS |
290 | <para>The age field only applies to lines starting with |
291 | d, D and x. If omitted or set to - no automatic clean-up | |
292 | is done.</para> | |
24f3a374 LP |
293 | |
294 | <para>If the age field starts with a tilde | |
295 | character (~) the clean-up is only applied to | |
296 | files and directories one level inside the | |
297 | directory specified, but not the files and | |
298 | directories immediately inside it.</para> | |
aeee2322 | 299 | </refsect2> |
4149f86d | 300 | |
468d726b LP |
301 | <refsect2> |
302 | <title>Argument</title> | |
303 | ||
304 | <para>For L lines determines the destination | |
305 | path of the symlink. For c, b determines the | |
306 | major/minor of the device node, with major and | |
307 | minor formatted as integers, separated by :, | |
31ed59c5 LP |
308 | e.g. "1:3". For f, F, w may be used to specify |
309 | a short string that is written to the file, | |
310 | suffixed by a newline. Ignored for all other | |
311 | lines.</para> | |
468d726b LP |
312 | </refsect2> |
313 | ||
4149f86d BP |
314 | </refsect1> |
315 | ||
316 | <refsect1> | |
317 | <title>Example</title> | |
318 | <example> | |
319 | <title>/etc/tmpfiles.d/screen.conf example</title> | |
320 | <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para> | |
321 | ||
468d726b | 322 | <programlisting>d /var/run/screens 1777 root root 10d |
aeee2322 | 323 | d /var/run/uscreens 0755 root root 10d12h</programlisting> |
4149f86d BP |
324 | </example> |
325 | </refsect1> | |
326 | ||
327 | <refsect1> | |
328 | <title>See Also</title> | |
329 | <para> | |
522d4a49 | 330 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
75945bad LP |
331 | <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
332 | <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
4149f86d BP |
333 | </para> |
334 | </refsect1> | |
335 | ||
336 | </refentry> |