chiark / gitweb /
man: wording and grammar updates
[elogind.git] / man / tmpfiles.d.xml
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
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
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
17   Lesser General Public License for more details.
18
19   You should have received a copy of the GNU Lesser General Public License
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>
45                 <refpurpose>Configuration for creation, deletion and
46                 cleaning of volatile and temporary files</refpurpose>
47         </refnamediv>
48
49         <refsynopsisdiv>
50                 <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
51                 <para><filename>/run/tmpfiles.d/*.conf</filename></para>
52                 <para><filename>/usr/lib/tmpfiles.d/*.conf</filename></para>
53         </refsynopsisdiv>
54
55         <refsect1>
56                 <title>Description</title>
57
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>
64         </refsect1>
65
66         <refsect1>
67                 <title>Configuration Format</title>
68
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
78                 <filename>/etc/</filename> are reserved for the local
79                 administrator, who may use this logic to override the
80                 configuration files installed by vendor packages. All
81                 configuration files are sorted by their filename in
82                 lexicographic order, regardless in which of the
83                 directories they reside. If multiple files specify the
84                 same path, the entry in the file with the lexicographically
85                 earliest name will be applied, all all other conflicting
86                 entries logged as errors.</para>
87
88                 <para>If the administrator wants to disable a
89                 configuration file supplied by the vendor, the
90                 recommended way is to place a symlink to
91                 <filename>/dev/null</filename> in
92                 <filename>/etc/tmpfiles.d/</filename> bearing the
93                 same filename.</para>
94
95                 <para>The configuration format is one line per path
96                 containing action, path, mode, ownership, age and argument
97                 fields:</para>
98
99                 <programlisting>Type Path        Mode UID  GID  Age Argument
100 d    /run/user   0755 root root 10d -
101 L    /tmp/foobar -    -    -    -   /dev/null</programlisting>
102
103                 <refsect2>
104                         <title>Type</title>
105                         <variablelist>
106                                 <varlistentry>
107                                         <term><varname>f</varname></term>
108                                         <listitem><para>Create a file if it does not exist yet (optionally writing a short string into it, if the argument parameter is passed)</para></listitem>
109                                 </varlistentry>
110
111                                 <varlistentry>
112                                         <term><varname>F</varname></term>
113                                         <listitem><para>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</para></listitem>
114                                 </varlistentry>
115
116                                 <varlistentry>
117                                         <term><varname>w</varname></term>
118                                         <listitem><para>Write the argument parameter to a file, if the file exists.
119                                             Lines of this type accept shell-style globs in place of normal path
120                                             names. The argument parameter will be written without a trailing
121                                             newline. C-style backslash escapes are interpreted.</para></listitem>
122                                 </varlistentry>
123
124                                 <varlistentry>
125                                         <term><varname>d</varname></term>
126                                         <listitem><para>Create a directory if it does not exist yet</para></listitem>
127                                 </varlistentry>
128
129                                 <varlistentry>
130                                         <term><varname>D</varname></term>
131                                         <listitem><para>Create or empty a directory</para></listitem>
132                                 </varlistentry>
133
134                                 <varlistentry>
135                                         <term><varname>p</varname></term>
136                                         <listitem><para>Create a named pipe (FIFO) if it does not exist yet</para></listitem>
137                                 </varlistentry>
138
139                                 <varlistentry>
140                                         <term><varname>L</varname></term>
141                                         <listitem><para>Create a symlink if it does not exist yet</para></listitem>
142                                 </varlistentry>
143
144                                 <varlistentry>
145                                         <term><varname>c</varname></term>
146                                         <listitem><para>Create a character device node if it does not exist yet</para></listitem>
147                                 </varlistentry>
148
149                                 <varlistentry>
150                                         <term><varname>b</varname></term>
151                                         <listitem><para>Create a block device node if it does not exist yet</para></listitem>
152                                 </varlistentry>
153
154                                 <varlistentry>
155                                         <term><varname>x</varname></term>
156                                         <listitem><para>Ignore a path
157                                         during cleaning. Use this type
158                                         to exclude paths from clean-up
159                                         as controlled with the Age
160                                         parameter. Note that lines of
161                                         this type do not influence the
162                                         effect of r or R lines. Lines
163                                         of this type accept
164                                         shell-style globs in place of
165                                         normal path
166                                         names.</para></listitem>
167                                 </varlistentry>
168
169                                 <varlistentry>
170                                         <term><varname>X</varname></term>
171                                         <listitem><para>Ignore a path
172                                         during cleanup. Use this type
173                                         to prevent path removal as
174                                         controlled with the Age parameter.
175                                         Note that if path is a directory,
176                                         content of a directory is not
177                                         excluded from clean-up, only
178                                         directory itself. Lines of this
179                                         type accept shell-style globs
180                                         in place of normal path
181                                         names.</para></listitem>
182                                 </varlistentry>
183
184                                 <varlistentry>
185                                         <term><varname>r</varname></term>
186                                         <listitem><para>Remove a file
187                                         or directory if it
188                                         exists. This may not be used
189                                         to remove non-empty
190                                         directories, use R for
191                                         that. Lines of this type
192                                         accept shell-style globs in
193                                         place of normal path
194                                         names.</para></listitem>
195                                 </varlistentry>
196
197                                 <varlistentry>
198                                         <term><varname>R</varname></term>
199                                         <listitem><para>Recursively
200                                         remove a path and all its
201                                         subdirectories (if it is a
202                                         directory). Lines of this type
203                                         accept shell-style globs in
204                                         place of normal path
205                                         names.</para></listitem>
206                                 </varlistentry>
207
208                                 <varlistentry>
209                                         <term><varname>z</varname></term>
210                                         <listitem><para>Restore
211                                         SELinux security context label
212                                         and set ownership and access
213                                         mode of a file or directory if
214                                         it exists.  Lines of this type
215                                         accept shell-style globs in
216                                         place of normal path names.
217                                         </para></listitem>
218                                 </varlistentry>
219
220                                 <varlistentry>
221                                         <term><varname>Z</varname></term>
222                                         <listitem><para>Recursively
223                                         restore SELinux security
224                                         context label and set
225                                         ownership and access mode of a
226                                         path and all its
227                                         subdirectories (if it is a
228                                         directory). Lines of this type
229                                         accept shell-style globs in
230                                         place of normal path
231                                         names.</para></listitem>
232                                 </varlistentry>
233                         </variablelist>
234                 </refsect2>
235
236                 <refsect2>
237                         <title>Mode</title>
238
239                         <para>The file access mode to use when
240                         creating this file or directory. If omitted or
241                         when set to -, the default is used: 0755 for
242                         directories, 0644 for all other file
243                         objects. For z, Z lines, if omitted or when set
244                         to -, the file access mode will not be
245                         modified. This parameter is ignored for x, r,
246                         R, L lines.</para>
247                 </refsect2>
248
249                 <refsect2>
250                         <title>UID, GID</title>
251
252                         <para>The user and group to use for this file
253                         or directory. This may either be a numeric
254                         user/group ID or a user or group name. If
255                         omitted or when set to -, the default 0 (root)
256                         is used. For z, Z lines, when omitted or when set to -,
257                         the file ownership will not be modified.
258                         These parameters are ignored for x, r, R, L lines.</para>
259                 </refsect2>
260
261                 <refsect2>
262                         <title>Age</title>
263                         <para>The date field, when set, is used to
264                         decide what files to delete when cleaning. If
265                         a file or directory is older than the current
266                         time minus the age field, it is deleted. The
267                         field format is a series of integers each
268                         followed by one of the following
269                         postfixes for the respective time units:</para>
270
271                         <variablelist>
272                                 <varlistentry>
273                                 <term><varname>s</varname></term>
274                                 <term><varname>min</varname></term>
275                                 <term><varname>h</varname></term>
276                                 <term><varname>d</varname></term>
277                                 <term><varname>w</varname></term>
278                                 <term><varname>ms</varname></term>
279                                 <term><varname>m</varname></term>
280                                 <term><varname>us</varname></term></varlistentry>
281                         </variablelist>
282
283                         <para>If multiple integers and units are specified, the time
284                         values are summed up. If an integer is given without a unit,
285                         s is assumed.
286                         </para>
287
288                         <para>When the age is set to zero, the files are cleaned
289                         unconditionally.</para>
290
291                         <para>The age field only applies to lines starting with
292                         d, D and x. If omitted or set to -, no automatic clean-up
293                         is done.</para>
294
295                         <para>If the age field starts with a tilde
296                         character (~), the clean-up is only applied to
297                         files and directories one level inside the
298                         directory specified, but not the files and
299                         directories immediately inside it.</para>
300                 </refsect2>
301
302                 <refsect2>
303                         <title>Argument</title>
304
305                         <para>For L lines determines the destination
306                         path of the symlink. For c, b determines the
307                         major/minor of the device node, with major and
308                         minor formatted as integers, separated by :,
309                         e.g. "1:3". For f, F, w may be used to specify
310                         a short string that is written to the file,
311                         suffixed by a newline. Ignored for all other
312                         lines.</para>
313                 </refsect2>
314
315         </refsect1>
316
317         <refsect1>
318                 <title>Example</title>
319                 <example>
320                         <title>/etc/tmpfiles.d/screen.conf example</title>
321                         <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
322
323                         <programlisting>d /var/run/screens  1777 root root 10d
324 d /var/run/uscreens 0755 root root 10d12h</programlisting>
325                 </example>
326                 <example>
327                         <title>/etc/tmpfiles.d/abrt.conf example</title>
328                         <para><command>abrt</command> needs a directory created at boot with specific mode and ownership and its content should be preserved.</para>
329
330                         <programlisting>d /var/tmp/abrt 0755 abrt abrt
331 x /var/tmp/abrt/*</programlisting>
332                 </example>
333         </refsect1>
334
335         <refsect1>
336                 <title>See Also</title>
337                 <para>
338                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
339                         <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
340                         <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>
341                 </para>
342         </refsect1>
343
344 </refentry>