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