]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.path.xml
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.git] / man / systemd.path.xml
CommitLineData
b36b082c 1<?xml version='1.0'?> <!--*-nxml-*-->
b36b082c 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
b36b082c
LP
4
5<!--
572eb058 6 SPDX-License-Identifier: LGPL-2.1+
b36b082c
LP
7-->
8
9<refentry id="systemd.path">
798d3a52
ZJS
10 <refentryinfo>
11 <title>systemd.path</title>
12 <productname>systemd</productname>
13
14 <authorgroup>
15 <author>
16 <contrib>Developer</contrib>
17 <firstname>Lennart</firstname>
18 <surname>Poettering</surname>
19 <email>lennart@poettering.net</email>
20 </author>
21 </authorgroup>
22 </refentryinfo>
23
24 <refmeta>
25 <refentrytitle>systemd.path</refentrytitle>
26 <manvolnum>5</manvolnum>
27 </refmeta>
28
29 <refnamediv>
30 <refname>systemd.path</refname>
31 <refpurpose>Path unit configuration</refpurpose>
32 </refnamediv>
33
34 <refsynopsisdiv>
35 <para><filename><replaceable>path</replaceable>.path</filename></para>
36 </refsynopsisdiv>
37
38 <refsect1>
39 <title>Description</title>
40
41 <para>A unit configuration file whose name ends in
42 <literal>.path</literal> encodes information about a path
43 monitored by systemd, for path-based activation.</para>
44
45 <para>This man page lists the configuration options specific to
46 this unit type. See
47 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
48 for the common options of all unit configuration files. The common
49 configuration items are configured in the generic [Unit] and
50 [Install] sections. The path specific configuration options are
51 configured in the [Path] section.</para>
52
53 <para>For each path file, a matching unit file must exist,
54 describing the unit to activate when the path changes. By default,
55 a service by the same name as the path (except for the suffix) is
56 activated. Example: a path file <filename>foo.path</filename>
57 activates a matching service <filename>foo.service</filename>. The
58 unit to activate may be controlled by <varname>Unit=</varname>
59 (see below).</para>
60
61 <para>Internally, path units use the
3ba3a79d 62 <citerefentry project='man-pages'><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>
798d3a52
ZJS
63 API to monitor file systems. Due to that, it suffers by the same
64 limitations as inotify, and for example cannot be used to monitor
65 files or directories changed by other machines on remote NFS file
66 systems.</para>
c129bd5d 67 </refsect1>
798d3a52 68
c129bd5d 69 <refsect1>
aed5cb03 70 <title>Automatic Dependencies</title>
45f09f93 71
aed5cb03
ZJS
72 <refsect2>
73 <title>Implicit Dependencies</title>
45f09f93 74
aed5cb03 75 <para>The following dependencies are implicitly added:</para>
45f09f93 76
aed5cb03
ZJS
77 <itemizedlist>
78 <listitem><para>If a path unit is beneath another mount unit in the file
79 system hierarchy, both a requirement and an ordering dependency
80 between both units are created automatically.</para></listitem>
45f09f93 81
aed5cb03
ZJS
82 <listitem><para>An implicit <varname>Before=</varname> dependency is added
83 between a path unit and the unit it is supposed to activate.</para></listitem>
84 </itemizedlist>
85 </refsect2>
86
87 <refsect2>
88 <title>Default Dependencies</title>
45f09f93 89
aed5cb03 90 <para>The following dependencies are added unless <varname>DefaultDependencies=no</varname> is set:</para>
45f09f93 91
aed5cb03
ZJS
92 <itemizedlist>
93 <listitem><para>Path units will automatically have dependencies of type <varname>Before=</varname> on
94 <filename>paths.target</filename>,
95 dependencies of type <varname>After=</varname> and <varname>Requires=</varname> on
96 <filename>sysinit.target</filename>, and have dependencies of type <varname>Conflicts=</varname> and
97 <varname>Before=</varname> on <filename>shutdown.target</filename>. These ensure that path units are terminated
98 cleanly prior to system shutdown. Only path units involved with early boot or late system shutdown should
99 disable <varname>DefaultDependencies=</varname> option.</para></listitem>
100 </itemizedlist>
45f09f93 101
aed5cb03
ZJS
102 <para></para>
103 </refsect2>
798d3a52
ZJS
104 </refsect1>
105
106 <refsect1>
107 <title>Options</title>
108
109 <para>Path files must include a [Path] section, which carries
110 information about the path(s) it monitors. The options specific to
111 the [Path] section of path units are the following:</para>
112
113 <variablelist class='unit-directives'>
114 <varlistentry>
115 <term><varname>PathExists=</varname></term>
116 <term><varname>PathExistsGlob=</varname></term>
117 <term><varname>PathChanged=</varname></term>
118 <term><varname>PathModified=</varname></term>
119 <term><varname>DirectoryNotEmpty=</varname></term>
120
121 <listitem><para>Defines paths to monitor for certain changes:
122 <varname>PathExists=</varname> may be used to watch the mere
123 existence of a file or directory. If the file specified
124 exists, the configured unit is activated.
125 <varname>PathExistsGlob=</varname> works similar, but checks
126 for the existence of at least one file matching the globbing
127 pattern specified. <varname>PathChanged=</varname> may be used
128 to watch a file or directory and activate the configured unit
129 whenever it changes. It is not activated on every write to the
130 watched file but it is activated if the file which was open
131 for writing gets closed. <varname>PathModified=</varname> is
132 similar, but additionally it is activated also on simple
133 writes to the watched file.
134 <varname>DirectoryNotEmpty=</varname> may be used to watch a
135 directory and activate the configured unit whenever it
136 contains at least one file.</para>
137
138 <para>The arguments of these directives must be absolute file
139 system paths.</para>
140
141 <para>Multiple directives may be combined, of the same and of
142 different types, to watch multiple paths. If the empty string
143 is assigned to any of these options, the list of paths to
144 watch is reset, and any prior assignments of these options
145 will not have any effect.</para>
146
147 <para>If a path already exists (in case of
148 <varname>PathExists=</varname> and
149 <varname>PathExistsGlob=</varname>) or a directory already is
150 not empty (in case of <varname>DirectoryNotEmpty=</varname>)
151 at the time the path unit is activated, then the configured
152 unit is immediately activated as well. Something similar does
153 not apply to <varname>PathChanged=</varname> and
154 <varname>PathModified=</varname>.</para>
155
156 <para>If the path itself or any of the containing directories
157 are not accessible, <command>systemd</command> will watch for
158 permission changes and notice that conditions are satisfied
159 when permissions allow that. </para></listitem>
160 </varlistentry>
161 <varlistentry>
162 <term><varname>Unit=</varname></term>
163
164 <listitem><para>The unit to activate when any of the
165 configured paths changes. The argument is a unit name, whose
166 suffix is not <literal>.path</literal>. If not specified, this
167 value defaults to a service that has the same name as the path
168 unit, except for the suffix. (See above.) It is recommended
169 that the unit name that is activated and the unit name of the
170 path unit are named identical, except for the
171 suffix.</para></listitem>
172 </varlistentry>
173 <varlistentry>
174 <term><varname>MakeDirectory=</varname></term>
175
176 <listitem><para>Takes a boolean argument. If true, the
177 directories to watch are created before watching. This option
178 is ignored for <varname>PathExists=</varname> settings.
179 Defaults to <option>false</option>.</para></listitem>
180 </varlistentry>
181 <varlistentry>
182 <term><varname>DirectoryMode=</varname></term>
183
184 <listitem><para>If <varname>MakeDirectory=</varname> is
185 enabled, use the mode specified here to create the directories
186 in question. Takes an access mode in octal notation. Defaults
187 to <option>0755</option>.</para></listitem>
188 </varlistentry>
189 </variablelist>
190 </refsect1>
191
192 <refsect1>
193 <title>See Also</title>
194 <para>
195 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
196 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
197 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
198 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d 199 <citerefentry project='man-pages'><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
798d3a52
ZJS
200 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
201 </para>
202 </refsect1>
b36b082c
LP
203
204</refentry>