chiark / gitweb /
tmpfiles: add support for creating symlinks, char/block device nodes
[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 General Public License as published by
11   the Free Software Foundation; either version 2 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   General Public License for more details.
18
19   You should have received a copy of the GNU 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>/usr/lib/tmpfiles.d/*.conf</filename></para>
51                 <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
52                 <para><filename>/run/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 is named in the style of
70                 <filename>&lt;program&gt;.conf</filename>.  Files in
71                 <filename>/etc/</filename> override files with the
72                 same name in <filename>/usr/lib/</filename>.  Files in
73                 <filename>/run</filename> override files with the same
74                 name in <filename>/etc/</filename> and
75                 <filename>/usr/lib/</filename>. Packages should
76                 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 choose to override the
80                 configurations installed from packages. The list of
81                 configuration files are sorted by their filename in
82                 alphabetical order, regardless in which of the
83                 directories they reside, to guarantee that a
84                 configuration file takes precedence over another
85                 configuration file with an alphabetically later
86                 name.</para>
87
88                 <para>The configuration format is one line per path
89                 containing action, path, mode, ownership, age and argument
90                 fields:</para>
91
92                 <programlisting>Type Path        Mode UID  GID  Age Argument
93 d    /run/user   0755 root root 10d -
94 L    /tmp/foobar -    -    -    -   /dev/null</programlisting>
95
96                 <refsect2>
97                         <title>Type</title>
98                         <variablelist>
99                                 <varlistentry>
100                                         <term><varname>f</varname></term>
101                                         <listitem><para>Create a file if it doesn't exist yet</para></listitem>
102                                 </varlistentry>
103
104                                 <varlistentry>
105                                         <term><varname>F</varname></term>
106                                         <listitem><para>Create or truncate a file</para></listitem>
107                                 </varlistentry>
108
109                                 <varlistentry>
110                                         <term><varname>d</varname></term>
111                                         <listitem><para>Create a directory if it doesn't exist yet</para></listitem>
112                                 </varlistentry>
113
114                                 <varlistentry>
115                                         <term><varname>D</varname></term>
116                                         <listitem><para>Create or empty a directory</para></listitem>
117                                 </varlistentry>
118
119                                 <varlistentry>
120                                         <term><varname>p</varname></term>
121                                         <listitem><para>Create a named pipe (FIFO) if it doesn't exist yet</para></listitem>
122                                 </varlistentry>
123
124                                 <varlistentry>
125                                         <term><varname>L</varname></term>
126                                         <listitem><para>Create a symlink if it doesn't exist yet</para></listitem>
127                                 </varlistentry>
128
129                                 <varlistentry>
130                                         <term><varname>c</varname></term>
131                                         <listitem><para>Create a character device node if it doesn't exist yet</para></listitem>
132                                 </varlistentry>
133
134                                 <varlistentry>
135                                         <term><varname>b</varname></term>
136                                         <listitem><para>Create a block device node if it doesn't exist yet</para></listitem>
137                                 </varlistentry>
138
139                                 <varlistentry>
140                                         <term><varname>x</varname></term>
141                                         <listitem><para>Ignore a path
142                                         during cleaning. Use this type
143                                         to exclude paths from clean-up
144                                         as controlled with the Age
145                                         parameter. Note that lines of
146                                         this type do not influence the
147                                         effect of r or R lines. Lines
148                                         of this type accept
149                                         shell-style globs in place of
150                                         of normal path
151                                         names.</para></listitem>
152                                 </varlistentry>
153
154                                 <varlistentry>
155                                         <term><varname>r</varname></term>
156                                         <listitem><para>Remove a file
157                                         or directory if it
158                                         exists. This may not be used
159                                         to remove non-empty
160                                         directories, use R for
161                                         that. Lines of this type
162                                         accept shell-style globs in
163                                         place of normal path
164                                         names.</para></listitem>
165                                 </varlistentry>
166
167                                 <varlistentry>
168                                         <term><varname>R</varname></term>
169                                         <listitem><para>Recursively
170                                         remove a path and all its
171                                         subdirectories (if it is a
172                                         directory). Lines of this type
173                                         accept shell-style globs in
174                                         place of normal path
175                                         names.</para></listitem>
176                                 </varlistentry>
177
178                                 <varlistentry>
179                                         <term><varname>z</varname></term>
180                                         <listitem><para>Set ownership, access
181                                         mode and relabel security context of
182                                         a file or directory if it exists.
183                                         Lines of this type accept shell-style
184                                         globs in place of normal path names.
185                                         </para></listitem>
186                                 </varlistentry>
187
188                                 <varlistentry>
189                                         <term><varname>Z</varname></term>
190                                         <listitem><para>Recursively set
191                                         ownership, access mode and relabel
192                                         security context of a path and
193                                         all its subdirectories (if it is a
194                                         directory). Lines of this type accept
195                                         shell-style globs in place of normal
196                                         path names.</para></listitem>
197                                 </varlistentry>
198                         </variablelist>
199                 </refsect2>
200
201                 <refsect2>
202                         <title>Mode</title>
203
204                         <para>The file access mode to use when
205                         creating this file or directory. If omitted or
206                         when set to - the default is used: 0755 for
207                         directories, 0644 for all other file
208                         objects. For z, Z lines if omitted or when set
209                         to - the file access mode will not be
210                         modified. This parameter is ignored for x, r,
211                         R, L lines.</para>
212                 </refsect2>
213
214                 <refsect2>
215                         <title>UID, GID</title>
216
217                         <para>The user and group to use for this file
218                         or directory. This may either be a numeric
219                         user/group ID or a user or group name. If
220                         omitted or when set to - the default 0 (root)
221                         is used. For z, Z lines when omitted or when set to -
222                         the file ownership will not be modified.
223                         These parameters are ignored for x, r, R, L lines.</para>
224                 </refsect2>
225
226                 <refsect2>
227                         <title>Age</title>
228                         <para>The date field, when set, is used to
229                         decide what files to delete when cleaning. If
230                         a file or directory is older than the current
231                         time minus the age field it is deleted. The
232                         field format is a series of integers each
233                         followed by one of the following
234                         postfixes for the respective time units:</para>
235
236                         <variablelist>
237                                 <varlistentry>
238                                 <term><varname>s</varname></term>
239                                 <term><varname>min</varname></term>
240                                 <term><varname>h</varname></term>
241                                 <term><varname>d</varname></term>
242                                 <term><varname>w</varname></term>
243                                 <term><varname>ms</varname></term>
244                                 <term><varname>m</varname></term>
245                                 <term><varname>us</varname></term></varlistentry>
246                         </variablelist>
247
248                         <para>If multiple integers and units are specified the time
249                         values are summed up.</para>
250
251                         <para>The age field only applies to lines starting with
252                         d, D and x. If omitted or set to - no automatic clean-up
253                         is done.</para>
254                 </refsect2>
255
256                 <refsect2>
257                         <title>Argument</title>
258
259                         <para>For L lines determines the destination
260                         path of the symlink. For c, b determines the
261                         major/minor of the device node, with major and
262                         minor formatted as integers, separated by :,
263                         e.g. "1:3". Ignored for all other lines.</para>
264                 </refsect2>
265
266         </refsect1>
267
268         <refsect1>
269                 <title>Example</title>
270                 <example>
271                         <title>/etc/tmpfiles.d/screen.conf example</title>
272                         <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
273
274                         <programlisting>d /var/run/screens  1777 root root 10d
275 d /var/run/uscreens 0755 root root 10d12h</programlisting>
276                 </example>
277         </refsect1>
278
279         <refsect1>
280                 <title>See Also</title>
281                 <para>
282                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
283                         <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
284                 </para>
285         </refsect1>
286
287 </refentry>