]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-tmpfiles.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / systemd-tmpfiles.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2010 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="systemd-tmpfiles"
27 xmlns:xi="http://www.w3.org/2001/XInclude">
28
29 <refentryinfo>
30 <title>systemd-tmpfiles</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd-tmpfiles</refentrytitle>
45 <manvolnum>8</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>systemd-tmpfiles</refname>
50 <refname>systemd-tmpfiles-setup.service</refname>
51 <refname>systemd-tmpfiles-setup-dev.service</refname>
52 <refname>systemd-tmpfiles-clean.service</refname>
53 <refname>systemd-tmpfiles-clean.timer</refname>
54 <refpurpose>Creates, deletes and cleans up volatile
55 and temporary files and directories</refpurpose>
56 </refnamediv>
57
58 <refsynopsisdiv>
59 <cmdsynopsis>
60 <command>systemd-tmpfiles</command>
61 <arg choice="opt" rep="repeat">OPTIONS</arg>
62 <arg choice="opt" rep="repeat"><replaceable>CONFIGFILE</replaceable></arg>
63 </cmdsynopsis>
64
65 <para><filename>systemd-tmpfiles-setup.service</filename></para>
66 <para><filename>systemd-tmpfiles-setup-dev.service</filename></para>
67 <para><filename>systemd-tmpfiles-clean.service</filename></para>
68 <para><filename>systemd-tmpfiles-clean.timer</filename></para>
69 </refsynopsisdiv>
70
71 <refsect1>
72 <title>Description</title>
73
74 <para><command>systemd-tmpfiles</command> creates, deletes, and
75 cleans up volatile and temporary files and directories, based on
76 the configuration file format and location specified in
77 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
78 </para>
79
80 <para>If invoked with no arguments, it applies all directives from all configuration
81 files. If one or more absolute filenames are passed on the command line, only the
82 directives in these files are applied. If <literal>-</literal> is specified instead
83 of a filename, directives are read from standard input. If only the basename of a
84 configuration file is specified, all configuration directories as specified in
85 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
86 are searched for a matching file.</para>
87 </refsect1>
88
89 <refsect1>
90 <title>Options</title>
91
92 <para>The following options are understood:</para>
93
94 <variablelist>
95 <varlistentry>
96 <term><option>--create</option></term>
97 <listitem><para>If this option is passed, all files and
98 directories marked with
99 <varname>f</varname>,
100 <varname>F</varname>,
101 <varname>w</varname>,
102 <varname>d</varname>,
103 <varname>D</varname>,
104 <varname>v</varname>,
105 <varname>p</varname>,
106 <varname>L</varname>,
107 <varname>c</varname>,
108 <varname>b</varname>,
109 <varname>m</varname>
110 in the configuration files are created or written to. Files
111 and directories marked with
112 <varname>z</varname>,
113 <varname>Z</varname>,
114 <varname>t</varname>,
115 <varname>T</varname>,
116 <varname>a</varname>, and
117 <varname>A</varname> have their ownership, access mode and
118 security labels set. </para></listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><option>--clean</option></term>
123 <listitem><para>If this option is passed, all files and
124 directories with an age parameter configured will be cleaned
125 up.</para></listitem>
126 </varlistentry>
127
128 <varlistentry>
129 <term><option>--remove</option></term>
130 <listitem><para>If this option is passed, the contents of
131 directories marked with <varname>D</varname> or
132 <varname>R</varname>, and files or directories themselves
133 marked with <varname>r</varname> or <varname>R</varname> are
134 removed.</para></listitem>
135 </varlistentry>
136 <varlistentry>
137 <term><option>--boot</option></term>
138 <listitem><para>Also execute lines with an exclamation mark.
139 </para></listitem>
140 </varlistentry>
141 <varlistentry>
142 <term><option>--prefix=<replaceable>path</replaceable></option></term>
143 <listitem><para>Only apply rules with paths that start with
144 the specified prefix. This option can be specified multiple
145 times.</para></listitem>
146 </varlistentry>
147 <varlistentry>
148 <term><option>--exclude-prefix=<replaceable>path</replaceable></option></term>
149 <listitem><para>Ignore rules with paths that start with the
150 specified prefix. This option can be specified multiple
151 times.</para></listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><option>--root=<replaceable>root</replaceable></option></term>
156 <listitem><para>Takes a directory path as an argument. All paths will be prefixed with the given alternate
157 <replaceable>root</replaceable> path, including config search paths.</para>
158
159 <para>Note that this option does not alter how the users and groups specified in the configuration files are
160 resolved. With or without this option, users and groups are always resolved according to the host's user and
161 group databases, any such databases stored under the specified root directories are not
162 consulted.</para></listitem>
163 </varlistentry>
164
165 <xi:include href="standard-options.xml" xpointer="help" />
166 <xi:include href="standard-options.xml" xpointer="version" />
167 </variablelist>
168
169 <para>It is possible to combine <option>--create</option>,
170 <option>--clean</option>, and <option>--remove</option> in one
171 invocation. For example, during boot the following command line is
172 executed to ensure that all temporary and volatile directories are
173 removed and created according to the configuration file:</para>
174
175 <programlisting>systemd-tmpfiles --remove --create</programlisting>
176
177 </refsect1>
178
179 <refsect1>
180 <title>Unprivileged --cleanup operation</title>
181
182 <para><command>systemd-tmpfiles</command> tries to avoid changing
183 the access and modification times on the directories it accesses,
184 which requires <constant>CAP_ADMIN</constant> privileges. When
185 running as non-root, directories which are checked for files to
186 clean up will have their access time bumped, which might prevent
187 their cleanup.
188 </para>
189 </refsect1>
190
191 <refsect1>
192 <title>Exit status</title>
193
194 <para>On success, 0 is returned, a non-zero failure code
195 otherwise.</para>
196 </refsect1>
197
198 <refsect1>
199 <title>See Also</title>
200 <para>
201 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
202 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
203 </para>
204 </refsect1>
205
206 </refentry>