]>
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 | ||
522d4a49 | 58 | <para><command>systemd-tmpfiles</command> uses the |
772f8371 | 59 | configuration files from the above directories to describe the |
522d4a49 LP |
60 | creation, cleaning and removal of volatile and |
61 | temporary files and directories which usually reside | |
bb29785e | 62 | in directories such as <filename>/run</filename> |
772f8371 | 63 | or <filename>/tmp</filename>.</para> |
4149f86d BP |
64 | </refsect1> |
65 | ||
66 | <refsect1> | |
67 | <title>Configuration Format</title> | |
68 | ||
772f8371 | 69 | <para>Each configuration file is named in the style of |
468d726b LP |
70 | <filename><program>.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> | |
772f8371 | 87 | |
aeee2322 | 88 | <para>The configuration format is one line per path |
468d726b | 89 | containing action, path, mode, ownership, age and argument |
aeee2322 LP |
90 | fields:</para> |
91 | ||
468d726b LP |
92 | <programlisting>Type Path Mode UID GID Age Argument |
93 | d /run/user 0755 root root 10d - | |
94 | L /tmp/foobar - - - - /dev/null</programlisting> | |
aeee2322 LP |
95 | |
96 | <refsect2> | |
88aebb62 | 97 | <title>Type</title> |
aeee2322 LP |
98 | <variablelist> |
99 | <varlistentry> | |
100 | <term><varname>f</varname></term> | |
31ed59c5 | 101 | <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 |
102 | </varlistentry> |
103 | ||
104 | <varlistentry> | |
105 | <term><varname>F</varname></term> | |
31ed59c5 LP |
106 | <listitem><para>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</para></listitem> |
107 | </varlistentry> | |
108 | ||
109 | <varlistentry> | |
110 | <term><varname>w</varname></term> | |
111 | <listitem><para>Write the argument parameter to a file, if it exists.</para></listitem> | |
aeee2322 LP |
112 | </varlistentry> |
113 | ||
114 | <varlistentry> | |
115 | <term><varname>d</varname></term> | |
a7c64469 | 116 | <listitem><para>Create a directory if it doesn't exist yet</para></listitem> |
aeee2322 LP |
117 | </varlistentry> |
118 | ||
119 | <varlistentry> | |
120 | <term><varname>D</varname></term> | |
a7c64469 | 121 | <listitem><para>Create or empty a directory</para></listitem> |
aeee2322 LP |
122 | </varlistentry> |
123 | ||
ee17ee7c LP |
124 | <varlistentry> |
125 | <term><varname>p</varname></term> | |
126 | <listitem><para>Create a named pipe (FIFO) if it doesn't exist yet</para></listitem> | |
127 | </varlistentry> | |
128 | ||
468d726b LP |
129 | <varlistentry> |
130 | <term><varname>L</varname></term> | |
131 | <listitem><para>Create a symlink if it doesn't exist yet</para></listitem> | |
132 | </varlistentry> | |
133 | ||
134 | <varlistentry> | |
135 | <term><varname>c</varname></term> | |
136 | <listitem><para>Create a character device node if it doesn't exist yet</para></listitem> | |
137 | </varlistentry> | |
138 | ||
139 | <varlistentry> | |
140 | <term><varname>b</varname></term> | |
141 | <listitem><para>Create a block device node if it doesn't exist yet</para></listitem> | |
142 | </varlistentry> | |
143 | ||
aeee2322 LP |
144 | <varlistentry> |
145 | <term><varname>x</varname></term> | |
b8bb3e8f LP |
146 | <listitem><para>Ignore a path |
147 | during cleaning. Use this type | |
148 | to exclude paths from clean-up | |
149 | as controlled with the Age | |
150 | parameter. Note that lines of | |
151 | this type do not influence the | |
152 | effect of r or R lines. Lines | |
153 | of this type accept | |
154 | shell-style globs in place of | |
155 | of normal path | |
156 | names.</para></listitem> | |
aeee2322 LP |
157 | </varlistentry> |
158 | ||
159 | <varlistentry> | |
160 | <term><varname>r</varname></term> | |
b8bb3e8f LP |
161 | <listitem><para>Remove a file |
162 | or directory if it | |
163 | exists. This may not be used | |
164 | to remove non-empty | |
165 | directories, use R for | |
166 | that. Lines of this type | |
167 | accept shell-style globs in | |
168 | place of normal path | |
169 | names.</para></listitem> | |
aeee2322 LP |
170 | </varlistentry> |
171 | ||
172 | <varlistentry> | |
173 | <term><varname>R</varname></term> | |
b8bb3e8f LP |
174 | <listitem><para>Recursively |
175 | remove a path and all its | |
176 | subdirectories (if it is a | |
177 | directory). Lines of this type | |
178 | accept shell-style globs in | |
179 | place of normal path | |
180 | names.</para></listitem> | |
aeee2322 | 181 | </varlistentry> |
462d63db | 182 | |
777b87e7 MS |
183 | <varlistentry> |
184 | <term><varname>z</varname></term> | |
669e49fe LP |
185 | <listitem><para>Restore |
186 | SELinux security context label | |
187 | and set ownership and access | |
188 | mode of a file or directory if | |
189 | it exists. Lines of this type | |
190 | accept shell-style globs in | |
191 | place of normal path names. | |
777b87e7 MS |
192 | </para></listitem> |
193 | </varlistentry> | |
194 | ||
462d63db MS |
195 | <varlistentry> |
196 | <term><varname>Z</varname></term> | |
669e49fe LP |
197 | <listitem><para>Recursively |
198 | restore SELinux security | |
199 | context label and set | |
200 | ownership and access mode of a | |
201 | path and all its | |
202 | subdirectories (if it is a | |
203 | directory). Lines of this type | |
204 | accept shell-style globs in | |
205 | place of normal path | |
206 | names.</para></listitem> | |
462d63db | 207 | </varlistentry> |
aeee2322 LP |
208 | </variablelist> |
209 | </refsect2> | |
210 | ||
211 | <refsect2> | |
88aebb62 LP |
212 | <title>Mode</title> |
213 | ||
b8bb3e8f LP |
214 | <para>The file access mode to use when |
215 | creating this file or directory. If omitted or | |
216 | when set to - the default is used: 0755 for | |
468d726b LP |
217 | directories, 0644 for all other file |
218 | objects. For z, Z lines if omitted or when set | |
219 | to - the file access mode will not be | |
220 | modified. This parameter is ignored for x, r, | |
221 | R, L lines.</para> | |
88aebb62 LP |
222 | </refsect2> |
223 | ||
224 | <refsect2> | |
225 | <title>UID, GID</title> | |
226 | ||
227 | <para>The user and group to use for this file | |
228 | or directory. This may either be a numeric | |
229 | user/group ID or a user or group name. If | |
b8bb3e8f | 230 | omitted or when set to - the default 0 (root) |
777b87e7 | 231 | is used. For z, Z lines when omitted or when set to - |
062e01bb | 232 | the file ownership will not be modified. |
468d726b | 233 | These parameters are ignored for x, r, R, L lines.</para> |
88aebb62 LP |
234 | </refsect2> |
235 | ||
236 | <refsect2> | |
237 | <title>Age</title> | |
aeee2322 LP |
238 | <para>The date field, when set, is used to |
239 | decide what files to delete when cleaning. If | |
240 | a file or directory is older than the current | |
241 | time minus the age field it is deleted. The | |
242 | field format is a series of integers each | |
243 | followed by one of the following | |
244 | postfixes for the respective time units:</para> | |
245 | ||
246 | <variablelist> | |
247 | <varlistentry> | |
248 | <term><varname>s</varname></term> | |
249 | <term><varname>min</varname></term> | |
250 | <term><varname>h</varname></term> | |
251 | <term><varname>d</varname></term> | |
252 | <term><varname>w</varname></term> | |
253 | <term><varname>ms</varname></term> | |
254 | <term><varname>m</varname></term> | |
255 | <term><varname>us</varname></term></varlistentry> | |
256 | </variablelist> | |
4149f86d | 257 | |
772f8371 KS |
258 | <para>If multiple integers and units are specified the time |
259 | values are summed up.</para> | |
4149f86d | 260 | |
772f8371 KS |
261 | <para>The age field only applies to lines starting with |
262 | d, D and x. If omitted or set to - no automatic clean-up | |
263 | is done.</para> | |
aeee2322 | 264 | </refsect2> |
4149f86d | 265 | |
468d726b LP |
266 | <refsect2> |
267 | <title>Argument</title> | |
268 | ||
269 | <para>For L lines determines the destination | |
270 | path of the symlink. For c, b determines the | |
271 | major/minor of the device node, with major and | |
272 | minor formatted as integers, separated by :, | |
31ed59c5 LP |
273 | e.g. "1:3". For f, F, w may be used to specify |
274 | a short string that is written to the file, | |
275 | suffixed by a newline. Ignored for all other | |
276 | lines.</para> | |
468d726b LP |
277 | </refsect2> |
278 | ||
4149f86d BP |
279 | </refsect1> |
280 | ||
281 | <refsect1> | |
282 | <title>Example</title> | |
283 | <example> | |
284 | <title>/etc/tmpfiles.d/screen.conf example</title> | |
285 | <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para> | |
286 | ||
468d726b | 287 | <programlisting>d /var/run/screens 1777 root root 10d |
aeee2322 | 288 | d /var/run/uscreens 0755 root root 10d12h</programlisting> |
4149f86d BP |
289 | </example> |
290 | </refsect1> | |
291 | ||
292 | <refsect1> | |
293 | <title>See Also</title> | |
294 | <para> | |
522d4a49 LP |
295 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
296 | <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
4149f86d BP |
297 | </para> |
298 | </refsect1> | |
299 | ||
300 | </refentry> |