]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/tmpfiles.d.xml
tmpfiles.d: switch to stacked config dirs in /lib, /etc, /run
[thirdparty/systemd.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>.
71 Files in <filename>/etc/</filename> overwrite
72 files with the same name in <filename>/usr/lib/</filename>.
73 Files in <filename>/run</filename> overwrite files with
74 the same name in <filename>/etc/</filename> and
75 <filename>/usr/lib/</filename>. Packages should install their
76 configuration files in <filename>/usr/lib/</filename>, files
77 in <filename>/etc/</filename> are reserved for the local
78 administration, which possibly decides to overwrite the
79 configurations installed from packages. All files are sorted
80 by filename in alphabetical order, regardless in which of the
81 directories they reside, to ensure that a specific
82 configuration file takes precedence over another file with
83 an alphabetically later name.</para>
84
85 <para>The configuration format is one line per path
86 containing action, mode, ownership and age
87 fields:</para>
88
89 <programlisting>Type Path Mode UID GID Age
90 d /run/user 0755 root root 10d</programlisting>
91
92 <refsect2>
93 <title>Type</title>
94 <variablelist>
95 <varlistentry>
96 <term><varname>f</varname></term>
97 <listitem><para>Create a file if it doesn't exist yet</para></listitem>
98 </varlistentry>
99
100 <varlistentry>
101 <term><varname>F</varname></term>
102 <listitem><para>Create or truncate a file</para></listitem>
103 </varlistentry>
104
105 <varlistentry>
106 <term><varname>d</varname></term>
107 <listitem><para>Create a directory if it doesn't exist yet</para></listitem>
108 </varlistentry>
109
110 <varlistentry>
111 <term><varname>D</varname></term>
112 <listitem><para>Create or empty a directory</para></listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><varname>x</varname></term>
117 <listitem><para>Ignore a path
118 during cleaning. Use this type
119 to exclude paths from clean-up
120 as controlled with the Age
121 parameter. Note that lines of
122 this type do not influence the
123 effect of r or R lines. Lines
124 of this type accept
125 shell-style globs in place of
126 of normal path
127 names.</para></listitem>
128 </varlistentry>
129
130 <varlistentry>
131 <term><varname>r</varname></term>
132 <listitem><para>Remove a file
133 or directory if it
134 exists. This may not be used
135 to remove non-empty
136 directories, use R for
137 that. Lines of this type
138 accept shell-style globs in
139 place of normal path
140 names.</para></listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><varname>R</varname></term>
145 <listitem><para>Recursively
146 remove a path and all its
147 subdirectories (if it is a
148 directory). Lines of this type
149 accept shell-style globs in
150 place of normal path
151 names.</para></listitem>
152 </varlistentry>
153 </variablelist>
154 </refsect2>
155
156 <refsect2>
157 <title>Mode</title>
158
159 <para>The file access mode to use when
160 creating this file or directory. If omitted or
161 when set to - the default is used: 0755 for
162 directories, 0644 for files. This parameter is
163 ignored for x, r, R lines.</para>
164 </refsect2>
165
166 <refsect2>
167 <title>UID, GID</title>
168
169 <para>The user and group to use for this file
170 or directory. This may either be a numeric
171 user/group ID or a user or group name. If
172 omitted or when set to - the default 0 (root)
173 is used. . These parameters are ignored for x,
174 r, R lines.</para>
175 </refsect2>
176
177 <refsect2>
178 <title>Age</title>
179 <para>The date field, when set, is used to
180 decide what files to delete when cleaning. If
181 a file or directory is older than the current
182 time minus the age field it is deleted. The
183 field format is a series of integers each
184 followed by one of the following
185 postfixes for the respective time units:</para>
186
187 <variablelist>
188 <varlistentry>
189 <term><varname>s</varname></term>
190 <term><varname>min</varname></term>
191 <term><varname>h</varname></term>
192 <term><varname>d</varname></term>
193 <term><varname>w</varname></term>
194 <term><varname>ms</varname></term>
195 <term><varname>m</varname></term>
196 <term><varname>us</varname></term></varlistentry>
197 </variablelist>
198
199 <para>If multiple integers and units are specified the time
200 values are summed up.</para>
201
202 <para>The age field only applies to lines starting with
203 d, D and x. If omitted or set to - no automatic clean-up
204 is done.</para>
205 </refsect2>
206
207 </refsect1>
208
209 <refsect1>
210 <title>Example</title>
211 <example>
212 <title>/etc/tmpfiles.d/screen.conf example</title>
213 <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
214
215 <programlisting>d /var/run/screens 1777 root root 10d
216 d /var/run/uscreens 0755 root root 10d12h</programlisting>
217 </example>
218 </refsect1>
219
220 <refsect1>
221 <title>See Also</title>
222 <para>
223 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
224 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
225 </para>
226 </refsect1>
227
228 </refentry>