]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-tmpfiles.xml
tmpfiles: add a special return code for syntax failures
[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
137 <varlistentry>
138 <term><option>--boot</option></term>
139 <listitem><para>Also execute lines with an exclamation mark.
140 </para></listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><option>--prefix=<replaceable>path</replaceable></option></term>
145 <listitem><para>Only apply rules with paths that start with
146 the specified prefix. This option can be specified multiple
147 times.</para></listitem>
148 </varlistentry>
149 <varlistentry>
150 <term><option>--exclude-prefix=<replaceable>path</replaceable></option></term>
151 <listitem><para>Ignore rules with paths that start with the
152 specified prefix. This option can be specified multiple
153 times.</para></listitem>
154 </varlistentry>
155
156 <varlistentry>
157 <term><option>--root=<replaceable>root</replaceable></option></term>
158 <listitem><para>Takes a directory path as an argument. All paths will be prefixed with the given alternate
159 <replaceable>root</replaceable> path, including config search paths.</para>
160
161 <para>Note that this option does not alter how the users and groups specified in the configuration files are
162 resolved. With or without this option, users and groups are always resolved according to the host's user and
163 group databases, any such databases stored under the specified root directories are not
164 consulted.</para></listitem>
165 </varlistentry>
166
167 <xi:include href="standard-options.xml" xpointer="help" />
168 <xi:include href="standard-options.xml" xpointer="version" />
169 </variablelist>
170
171 <para>It is possible to combine <option>--create</option>,
172 <option>--clean</option>, and <option>--remove</option> in one
173 invocation. For example, during boot the following command line is
174 executed to ensure that all temporary and volatile directories are
175 removed and created according to the configuration file:</para>
176
177 <programlisting>systemd-tmpfiles --remove --create</programlisting>
178
179 </refsect1>
180
181 <refsect1>
182 <title>Unprivileged --cleanup operation</title>
183
184 <para><command>systemd-tmpfiles</command> tries to avoid changing
185 the access and modification times on the directories it accesses,
186 which requires <constant>CAP_ADMIN</constant> privileges. When
187 running as non-root, directories which are checked for files to
188 clean up will have their access time bumped, which might prevent
189 their cleanup.
190 </para>
191 </refsect1>
192
193 <refsect1>
194 <title>Exit status</title>
195
196 <para>On success, 0 is returned. If the configuration was invalid (invalid syntax, missing
197 arguments, …), so some lines had to be ignored, but no other errors occurred,
198 <constant>65</constant> is returned (<constant>EX_DATAERR</constant> from
199 <filename>/usr/include/sysexits.h</filename>). Otherwise, <constant>1</constant> is returned
200 (<constant>EXIT_FAILURE</constant> from <filename>/usr/include/stdlib.h</filename>).
201 </para>
202 </refsect1>
203
204 <refsect1>
205 <title>See Also</title>
206 <para>
207 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
208 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
209 </para>
210 </refsect1>
211
212 </refentry>