3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 This file is part of systemd.
7 Copyright 2010 Brandon Philips
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.
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.
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/>.
22 <refentry id="tmpfiles.d">
25 <title>tmpfiles.d</title>
26 <productname>systemd</productname>
30 <contrib>Documentation</contrib>
31 <firstname>Brandon</firstname>
32 <surname>Philips</surname>
33 <email>brandon@ifup.org</email>
39 <refentrytitle>tmpfiles.d</refentrytitle>
40 <manvolnum>5</manvolnum>
44 <refname>tmpfiles.d</refname>
45 <refpurpose>Configuration for creation, deletion and cleaning of temporary and volatile files</refpurpose>
49 <para><filename>/etc/tmpfiles.d/*.conf</filename></para>
53 <title>Description</title>
55 <para><command>systemd</command> uses
56 <filename>/etc/tmpfiles.d/</filename> to describe the
57 creation, cleaning and removal of volatile files and
58 directories which usually reside in directories such
59 as <filename>/var/run</filename> or
60 <filename>/tmp</filename>. Each configuration file is
62 <filename>/etc/tmpfiles.d/<program>.conf</filename>.</para>
66 <title>Configuration Format</title>
68 <para>The configuration format is one line per path
69 containing action, mode, ownership and age
72 <programlisting>Type Path Mode UID GID Age
73 d /var/run/user 0755 root root 10d</programlisting>
79 <term><varname>f</varname></term>
80 <listitem><para>Create a file if it doesn't exist yet</para></listitem>
84 <term><varname>F</varname></term>
85 <listitem><para>Create or truncate a file</para></listitem>
89 <term><varname>d</varname></term>
90 <listitem><para>Create a directory if it doesn't exist yet</para></listitem>
94 <term><varname>D</varname></term>
95 <listitem><para>Create or empty a directory</para></listitem>
99 <term><varname>x</varname></term>
100 <listitem><para>Ignore a path
101 during cleaning. Use this type
102 to exclude paths from clean-up
103 as controlled with the Age
104 parameter. Note that lines of
105 this type do not influence the
106 effect of r or R lines. Lines
108 shell-style globs in place of
110 names.</para></listitem>
114 <term><varname>r</varname></term>
115 <listitem><para>Remove a file
117 exists. This may not be used
119 directories, use R for
120 that. Lines of this type
121 accept shell-style globs in
123 names.</para></listitem>
127 <term><varname>R</varname></term>
128 <listitem><para>Recursively
129 remove a path and all its
130 subdirectories (if it is a
131 directory). Lines of this type
132 accept shell-style globs in
134 names.</para></listitem>
142 <para>The file access mode to use when
143 creating this file or directory. If omitted or
144 when set to - the default is used: 0755 for
145 directories, 0644 for files. This parameter is
146 ignored for x, r, R lines.</para>
150 <title>UID, GID</title>
152 <para>The user and group to use for this file
153 or directory. This may either be a numeric
154 user/group ID or a user or group name. If
155 omitted or when set to - the default 0 (root)
156 is used. . These parameters are ignored for x,
162 <para>The date field, when set, is used to
163 decide what files to delete when cleaning. If
164 a file or directory is older than the current
165 time minus the age field it is deleted. The
166 field format is a series of integers each
167 followed by one of the following
168 postfixes for the respective time units:</para>
172 <term><varname>s</varname></term>
173 <term><varname>min</varname></term>
174 <term><varname>h</varname></term>
175 <term><varname>d</varname></term>
176 <term><varname>w</varname></term>
177 <term><varname>ms</varname></term>
178 <term><varname>m</varname></term>
179 <term><varname>us</varname></term></varlistentry>
182 <para>If multiple integers and units are specified the time values are summed up.</para>
184 <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>
191 <title>Example</title>
193 <title>/etc/tmpfiles.d/screen.conf example</title>
194 <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
196 <programlisting>d /var/run/screens 1777 root root 10d
197 d /var/run/uscreens 0755 root root 10d12h</programlisting>
202 <title>See Also</title>
204 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>