]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.path.xml
condense assignment and path_kill_slashes calls
[thirdparty/systemd.git] / man / systemd.path.xml
CommitLineData
b36b082c
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5
6<!--
7 This file is part of systemd.
8
9 Copyright 2010 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
b36b082c
LP
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 19 Lesser General Public License for more details.
b36b082c 20
5430f7f2 21 You should have received a copy of the GNU Lesser General Public License
b36b082c
LP
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23-->
24
25<refentry id="systemd.path">
26 <refentryinfo>
27 <title>systemd.path</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd.path</refentrytitle>
42 <manvolnum>5</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.path</refname>
34511ca7 47 <refpurpose>Path unit configuration</refpurpose>
b36b082c
LP
48 </refnamediv>
49
50 <refsynopsisdiv>
e670b166 51 <para><filename><replaceable>path</replaceable>.path</filename></para>
b36b082c
LP
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>A unit configuration file whose name ends in
479fe882 58 <literal>.path</literal> encodes information about
b36b082c
LP
59 a path monitored by systemd, for
60 path-based activation.</para>
61
62 <para>This man page lists the configuration options
63 specific to this unit type. See
64 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65 for the common options of all unit configuration
66 files. The common configuration items are configured
67 in the generic [Unit] and [Install] sections. The
68 path specific configuration options are configured in
69 the [Path] section.</para>
70
b439c6ee 71 <para>For each path file, a matching unit file must
b36b082c 72 exist, describing the unit to activate when the path
b439c6ee 73 changes. By default, a service by the same name as the
b36b082c
LP
74 path (except for the suffix) is activated. Example: a
75 path file <filename>foo.path</filename> activates a
76 matching service <filename>foo.service</filename>. The
77 unit to activate may be controlled by
78 <varname>Unit=</varname> (see below).</para>
79
80 <para>Internally, path units use the
81 <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>
b439c6ee 82 API to monitor file systems. Due to that, it suffers by the
b36b082c
LP
83 same limitations as inotify, and for example cannot be
84 used to monitor files or directories changed by other
85 machines on remote NFS file systems.</para>
86
f848f8d8 87 <para>If a path unit is beneath another mount
b439c6ee 88 point in the file system hierarchy, a dependency
b36b082c 89 between both units is created automatically.</para>
62adf224 90
28a79bd2
ZJS
91 <para>Unless <varname>DefaultDependencies=false</varname>
92 is used, path units will implicitly have dependencies of
93 type <varname>Conflicts=</varname> and
62adf224
LP
94 <varname>Before=</varname> on
95 <filename>shutdown.target</filename>. These ensure
96 that path units are terminated cleanly prior to system
97 shutdown. Only path units involved with early boot or
28a79bd2
ZJS
98 late system shutdown should disable this option.
99 </para>
b36b082c
LP
100 </refsect1>
101
102 <refsect1>
103 <title>Options</title>
104
105 <para>Path files must include a [Path] section,
106 which carries information about the path(s) it
107 monitors. The options specific to the [Path] section
108 of path units are the following:</para>
109
ccc9a4f9 110 <variablelist class='unit-directives'>
b36b082c
LP
111 <varlistentry>
112 <term><varname>PathExists=</varname></term>
8092a428 113 <term><varname>PathExistsGlob=</varname></term>
b36b082c 114 <term><varname>PathChanged=</varname></term>
e9223856 115 <term><varname>PathModified=</varname></term>
b36b082c
LP
116 <term><varname>DirectoryNotEmpty=</varname></term>
117
118 <listitem><para>Defines paths to
119 monitor for certain changes:
120 <varname>PathExists=</varname> may be
b439c6ee 121 used to watch the mere existence of a
b36b082c 122 file or directory. If the file
79640424 123 specified exists, the configured unit
b36b082c 124 is
8092a428
LP
125 activated. <varname>PathExistsGlob=</varname>
126 works similar, but checks for the
dc786b29 127 existence of at least one file
8092a428
LP
128 matching the globbing pattern
129 specified. <varname>PathChanged=</varname>
b36b082c
LP
130 may be used to watch a file or
131 directory and activate the configured
74051b9b
LP
132 unit whenever it changes. It is not
133 activated on every write to the
134 watched file but it is activated if
135 the file which was open for writing
136 gets
137 closed. <varname>PathModified=</varname>
138 is similar, but additionally it is
139 activated also on simple writes to the
140 watched file.
e9223856 141 <varname>DirectoryNotEmpty=</varname>
b36b082c 142 may be used to watch a directory and
b439c6ee 143 activate the configured unit whenever
b36b082c
LP
144 it contains at least one file.</para>
145
146 <para>The arguments of these
147 directives must be absolute file
148 system paths.</para>
149
150 <para>Multiple directives may be
151 combined, of the same and of different
74051b9b
LP
152 types, to watch multiple paths. If the
153 empty string is assigned to any of
79640424 154 these options, the list of paths to
74051b9b
LP
155 watch is reset, and any prior
156 assignments of these options will not
157 have any effect.</para>
b36b082c 158
28a79bd2 159 <para>If a path already exists
b36b082c 160 (in case of
8092a428
LP
161 <varname>PathExists=</varname> and
162 <varname>PathExistsGlob=</varname>) or
163 a directory already is not empty (in
b36b082c
LP
164 case of
165 <varname>DirectoryNotEmpty=</varname>)
8092a428
LP
166 at the time the path unit is
167 activated, then the configured unit is
b36b082c
LP
168 immediately activated as
169 well. Something similar does not apply
28a79bd2
ZJS
170 to <varname>PathChanged=</varname> and
171 <varname>PathModified=</varname>.</para>
172
173 <para>If the path itself or any of the
174 containing directories are not
175 accessible, <command>systemd</command>
176 will watch for permission changes and
177 notice that conditions are satisfied
178 when permissions allow that.
b36b082c
LP
179 </para></listitem>
180 </varlistentry>
181 <varlistentry>
182 <term><varname>Unit=</varname></term>
183
184 <listitem><para>The unit to activate
185 when any of the configured paths
186 changes. The argument is a unit name,
187 whose suffix is not
479fe882 188 <literal>.path</literal>. If not
b439c6ee 189 specified, this value defaults to a
b36b082c
LP
190 service that has the same name as the
191 path unit, except for the suffix. (See
192 above.) It is recommended that the
193 unit name that is activated and the
b439c6ee
KS
194 unit name of the path unit are named
195 identical, except for the
b36b082c
LP
196 suffix.</para></listitem>
197 </varlistentry>
0e456f97
LP
198 <varlistentry>
199 <term><varname>MakeDirectory=</varname></term>
200
201 <listitem><para>Takes a boolean
79640424 202 argument. If true, the directories to
0e456f97
LP
203 watch are created before
204 watching. This option is ignored for
205 <varname>PathExists=</varname>
206 settings. Defaults to
207 <option>false</option>.</para></listitem>
208 </varlistentry>
209 <varlistentry>
210 <term><varname>DirectoryMode=</varname></term>
211
212 <listitem><para>If
213 <varname>MakeDirectory=</varname> is
79640424 214 enabled, use the mode specified here to
0e456f97
LP
215 create the directories in
216 question. Takes an access mode in
217 octal notation. Defaults to
218 <option>0755</option>.</para></listitem>
219 </varlistentry>
b36b082c
LP
220 </variablelist>
221 </refsect1>
222
223 <refsect1>
224 <title>See Also</title>
225 <para>
f3e219a2 226 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
b36b082c
LP
227 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
228 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
229 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
9cc2c8b7
ZJS
230 <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
231 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
b36b082c
LP
232 </para>
233 </refsect1>
234
235</refentry>