]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/tmpfiles.d.xml
systemd: document systemd-tmpfiles
[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>/etc/tmpfiles.d/*.conf</filename></para>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
56 <para><command>systemd-tmpfiles</command> uses the
57 configuration files in
58 <filename>/etc/tmpfiles.d/</filename> to describe the
59 creation, cleaning and removal of volatile and
60 temporary files and directories which usually reside
61 in directories such as <filename>/var/run</filename>
62 or <filename>/tmp</filename>. Each configuration file
63 is named in the style of
64 <filename>/etc/tmpfiles.d/&lt;program&gt;.conf</filename>.</para>
65 </refsect1>
66
67 <refsect1>
68 <title>Configuration Format</title>
69
70 <para>The configuration format is one line per path
71 containing action, mode, ownership and age
72 fields:</para>
73
74 <programlisting>Type Path Mode UID GID Age
75 d /var/run/user 0755 root root 10d</programlisting>
76
77 <refsect2>
78 <title>Type</title>
79 <variablelist>
80 <varlistentry>
81 <term><varname>f</varname></term>
82 <listitem><para>Create a file if it doesn't exist yet</para></listitem>
83 </varlistentry>
84
85 <varlistentry>
86 <term><varname>F</varname></term>
87 <listitem><para>Create or truncate a file</para></listitem>
88 </varlistentry>
89
90 <varlistentry>
91 <term><varname>d</varname></term>
92 <listitem><para>Create a directory if it doesn't exist yet</para></listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><varname>D</varname></term>
97 <listitem><para>Create or empty a directory</para></listitem>
98 </varlistentry>
99
100 <varlistentry>
101 <term><varname>x</varname></term>
102 <listitem><para>Ignore a path
103 during cleaning. Use this type
104 to exclude paths from clean-up
105 as controlled with the Age
106 parameter. Note that lines of
107 this type do not influence the
108 effect of r or R lines. Lines
109 of this type accept
110 shell-style globs in place of
111 of normal path
112 names.</para></listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><varname>r</varname></term>
117 <listitem><para>Remove a file
118 or directory if it
119 exists. This may not be used
120 to remove non-empty
121 directories, use R for
122 that. Lines of this type
123 accept shell-style globs in
124 place of normal path
125 names.</para></listitem>
126 </varlistentry>
127
128 <varlistentry>
129 <term><varname>R</varname></term>
130 <listitem><para>Recursively
131 remove a path and all its
132 subdirectories (if it is a
133 directory). Lines of this type
134 accept shell-style globs in
135 place of normal path
136 names.</para></listitem>
137 </varlistentry>
138 </variablelist>
139 </refsect2>
140
141 <refsect2>
142 <title>Mode</title>
143
144 <para>The file access mode to use when
145 creating this file or directory. If omitted or
146 when set to - the default is used: 0755 for
147 directories, 0644 for files. This parameter is
148 ignored for x, r, R lines.</para>
149 </refsect2>
150
151 <refsect2>
152 <title>UID, GID</title>
153
154 <para>The user and group to use for this file
155 or directory. This may either be a numeric
156 user/group ID or a user or group name. If
157 omitted or when set to - the default 0 (root)
158 is used. . These parameters are ignored for x,
159 r, R lines.</para>
160 </refsect2>
161
162 <refsect2>
163 <title>Age</title>
164 <para>The date field, when set, is used to
165 decide what files to delete when cleaning. If
166 a file or directory is older than the current
167 time minus the age field it is deleted. The
168 field format is a series of integers each
169 followed by one of the following
170 postfixes for the respective time units:</para>
171
172 <variablelist>
173 <varlistentry>
174 <term><varname>s</varname></term>
175 <term><varname>min</varname></term>
176 <term><varname>h</varname></term>
177 <term><varname>d</varname></term>
178 <term><varname>w</varname></term>
179 <term><varname>ms</varname></term>
180 <term><varname>m</varname></term>
181 <term><varname>us</varname></term></varlistentry>
182 </variablelist>
183
184 <para>If multiple integers and units are specified the time values are summed up.</para>
185
186 <para>The age field only applies to lines starting with d, D and x. If omitted or set to - no automatic clean-up is done.</para>
187
188 </refsect2>
189
190 </refsect1>
191
192 <refsect1>
193 <title>Example</title>
194 <example>
195 <title>/etc/tmpfiles.d/screen.conf example</title>
196 <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
197
198 <programlisting>d /var/run/screens 1777 root root 10d
199 d /var/run/uscreens 0755 root root 10d12h</programlisting>
200 </example>
201 </refsect1>
202
203 <refsect1>
204 <title>See Also</title>
205 <para>
206 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
207 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>
208 </para>
209 </refsect1>
210
211 </refentry>