chiark / gitweb /
man: update sd_bus_request_name() man page
[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;package&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
104                 <refsect2>
105                         <title>Type</title>
106
107                         <para>The following line types are understood:</para>
108
109                         <variablelist>
110                                 <varlistentry>
111                                         <term><varname>f</varname></term>
112                                         <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>
113                                 </varlistentry>
114
115                                 <varlistentry>
116                                         <term><varname>F</varname></term>
117                                         <listitem><para>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</para></listitem>
118                                 </varlistentry>
119
120                                 <varlistentry>
121                                         <term><varname>w</varname></term>
122                                         <listitem><para>Write the argument parameter to a file, if the file exists.
123                                             Lines of this type accept shell-style globs in place of normal path
124                                             names. The argument parameter will be written without a trailing
125                                             newline. C-style backslash escapes are interpreted.</para></listitem>
126                                 </varlistentry>
127
128                                 <varlistentry>
129                                         <term><varname>d</varname></term>
130                                         <listitem><para>Create a directory if it does not exist yet</para></listitem>
131                                 </varlistentry>
132
133                                 <varlistentry>
134                                         <term><varname>D</varname></term>
135                                         <listitem><para>Create or empty a directory</para></listitem>
136                                 </varlistentry>
137
138                                 <varlistentry>
139                                         <term><varname>p</varname></term>
140                                         <listitem><para>Create a named pipe (FIFO) if it does not exist yet</para></listitem>
141                                 </varlistentry>
142
143                                 <varlistentry>
144                                         <term><varname>L</varname></term>
145                                         <listitem><para>Create a symlink if it does not exist yet</para></listitem>
146                                 </varlistentry>
147
148                                 <varlistentry>
149                                         <term><varname>c</varname></term>
150                                         <listitem><para>Create a character device node if it does not exist yet</para></listitem>
151                                 </varlistentry>
152
153                                 <varlistentry>
154                                         <term><varname>b</varname></term>
155                                         <listitem><para>Create a block device node if it does not exist yet</para></listitem>
156                                 </varlistentry>
157
158                                 <varlistentry>
159                                         <term><varname>m</varname></term>
160                                         <listitem><para>If the
161                                         specified file path exists,
162                                         adjust its access mode, group
163                                         and user to the specified
164                                         values and reset the SELinux
165                                         label. If it does not exist, do
166                                         nothing.</para></listitem>
167                                 </varlistentry>
168
169                                 <varlistentry>
170                                         <term><varname>x</varname></term>
171                                         <listitem><para>Ignore a path
172                                         during cleaning. Use this type
173                                         to exclude paths from clean-up
174                                         as controlled with the Age
175                                         parameter. Note that lines of
176                                         this type do not influence the
177                                         effect of r or R lines. Lines
178                                         of this type accept
179                                         shell-style globs in place of
180                                         normal path
181                                         names.</para></listitem>
182                                 </varlistentry>
183
184                                 <varlistentry>
185                                         <term><varname>X</varname></term>
186                                         <listitem><para>Ignore a path
187                                         during cleaning. Use this type
188                                         to exclude paths from clean-up
189                                         as controlled with the Age
190                                         parameter. Unlike x, this
191                                         parameter will not exclude the
192                                         content if path is a directory,
193                                         but only directory itself.
194                                         Note that lines of this type do
195                                         not influence the effect of r
196                                         or R lines. Lines of this type
197                                         accept shell-style globs in
198                                         place of normal path
199                                         names.</para></listitem>
200                                 </varlistentry>
201
202                                 <varlistentry>
203                                         <term><varname>r</varname></term>
204                                         <listitem><para>Remove a file
205                                         or directory if it
206                                         exists. This may not be used
207                                         to remove non-empty
208                                         directories, use R for
209                                         that. Lines of this type
210                                         accept shell-style globs in
211                                         place of normal path
212                                         names.</para></listitem>
213                                 </varlistentry>
214
215                                 <varlistentry>
216                                         <term><varname>R</varname></term>
217                                         <listitem><para>Recursively
218                                         remove a path and all its
219                                         subdirectories (if it is a
220                                         directory). Lines of this type
221                                         accept shell-style globs in
222                                         place of normal path
223                                         names.</para></listitem>
224                                 </varlistentry>
225
226                                 <varlistentry>
227                                         <term><varname>z</varname></term>
228                                         <listitem><para>Restore
229                                         SELinux security context label
230                                         and set ownership and access
231                                         mode of a file or directory if
232                                         it exists.  Lines of this type
233                                         accept shell-style globs in
234                                         place of normal path names.
235                                         </para></listitem>
236                                 </varlistentry>
237
238                                 <varlistentry>
239                                         <term><varname>Z</varname></term>
240                                         <listitem><para>Recursively
241                                         restore SELinux security
242                                         context label and set
243                                         ownership and access mode of a
244                                         path and all its
245                                         subdirectories (if it is a
246                                         directory). Lines of this type
247                                         accept shell-style globs in
248                                         place of normal path
249                                         names.</para></listitem>
250                                 </varlistentry>
251                         </variablelist>
252                 </refsect2>
253
254                 <refsect2>
255                         <title>Path</title>
256
257                         <para>The file system path specification supports simple specifier
258                         expansion. The following expansions are
259                         understood:</para>
260
261                         <table>
262                                 <title>Specifiers available</title>
263                                 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
264                                         <colspec colname="spec" />
265                                         <colspec colname="mean" />
266                                         <colspec colname="detail" />
267                                         <thead>
268                                                 <row>
269                                                         <entry>Specifier</entry>
270                                                         <entry>Meaning</entry>
271                                                         <entry>Details</entry>
272                                                 </row>
273                                         </thead>
274                                         <tbody>
275                                                 <row>
276                                                         <entry><literal>%m</literal></entry>
277                                                         <entry>Machine ID</entry>
278                                                         <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>
279                                                 </row>
280                                                 <row>
281                                                         <entry><literal>%b</literal></entry>
282                                                         <entry>Boot ID</entry>
283                                                         <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
284                                                 </row>
285                                                 <row>
286                                                         <entry><literal>%H</literal></entry>
287                                                         <entry>Host name</entry>
288                                                         <entry>The hostname of the running system.</entry>
289                                                 </row>
290                                                 <row>
291                                                         <entry><literal>%v</literal></entry>
292                                                         <entry>Kernel release</entry>
293                                                         <entry>Identical to <command>uname -r</command> output.</entry>
294                                                 </row>
295                                                 <row>
296                                                         <entry><literal>%%</literal></entry>
297                                                         <entry>Escaped %</entry>
298                                                         <entry>Single percent sign.</entry>
299                                                 </row>
300                                         </tbody>
301                                 </tgroup>
302                         </table>
303                 </refsect2>
304
305                 <refsect2>
306                         <title>Mode</title>
307
308                         <para>The file access mode to use when
309                         creating this file or directory. If omitted or
310                         when set to -, the default is used: 0755 for
311                         directories, 0644 for all other file
312                         objects. For z, Z lines, if omitted or when set
313                         to -, the file access mode will not be
314                         modified. This parameter is ignored for x, r,
315                         R, L lines.</para>
316                 </refsect2>
317
318                 <refsect2>
319                         <title>UID, GID</title>
320
321                         <para>The user and group to use for this file
322                         or directory. This may either be a numeric
323                         user/group ID or a user or group name. If
324                         omitted or when set to -, the default 0 (root)
325                         is used. For z, Z lines, when omitted or when set to -,
326                         the file ownership will not be modified.
327                         These parameters are ignored for x, r, R, L lines.</para>
328                 </refsect2>
329
330                 <refsect2>
331                         <title>Age</title>
332                         <para>The date field, when set, is used to
333                         decide what files to delete when cleaning. If
334                         a file or directory is older than the current
335                         time minus the age field, it is deleted. The
336                         field format is a series of integers each
337                         followed by one of the following
338                         postfixes for the respective time units:</para>
339
340                         <variablelist>
341                                 <varlistentry>
342                                 <term><varname>s</varname></term>
343                                 <term><varname>min</varname></term>
344                                 <term><varname>h</varname></term>
345                                 <term><varname>d</varname></term>
346                                 <term><varname>w</varname></term>
347                                 <term><varname>ms</varname></term>
348                                 <term><varname>m</varname></term>
349                                 <term><varname>us</varname></term></varlistentry>
350                         </variablelist>
351
352                         <para>If multiple integers and units are specified, the time
353                         values are summed up. If an integer is given without a unit,
354                         s is assumed.
355                         </para>
356
357                         <para>When the age is set to zero, the files are cleaned
358                         unconditionally.</para>
359
360                         <para>The age field only applies to lines starting with
361                         d, D and x. If omitted or set to -, no automatic clean-up
362                         is done.</para>
363
364                         <para>If the age field starts with a tilde
365                         character (~), the clean-up is only applied to
366                         files and directories one level inside the
367                         directory specified, but not the files and
368                         directories immediately inside it.</para>
369                 </refsect2>
370
371                 <refsect2>
372                         <title>Argument</title>
373
374                         <para>For L lines determines the destination
375                         path of the symlink. For c, b determines the
376                         major/minor of the device node, with major and
377                         minor formatted as integers, separated by :,
378                         e.g. "1:3". For f, F, w may be used to specify
379                         a short string that is written to the file,
380                         suffixed by a newline. Ignored for all other
381                         lines.</para>
382                 </refsect2>
383
384         </refsect1>
385
386         <refsect1>
387                 <title>Example</title>
388                 <example>
389                         <title>/etc/tmpfiles.d/screen.conf example</title>
390                         <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
391
392                         <programlisting>d /var/run/screens  1777 root root 10d
393 d /var/run/uscreens 0755 root root 10d12h</programlisting>
394                 </example>
395                 <example>
396                         <title>/etc/tmpfiles.d/abrt.conf example</title>
397                         <para><command>abrt</command> needs a directory created at boot with specific mode and ownership and its content should be preserved.</para>
398
399                         <programlisting>d /var/tmp/abrt 0755 abrt abrt
400 x /var/tmp/abrt/*</programlisting>
401                 </example>
402         </refsect1>
403
404         <refsect1>
405                 <title>See Also</title>
406                 <para>
407                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
408                         <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409                         <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>
410                 </para>
411         </refsect1>
412
413 </refentry>