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">
7 This file is part of systemd.
9 Copyright 2010 Lennart Poettering
11 systemd is free software; you can redistribute it and/or modify it
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
14 (at your option) any later version.
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
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 <refentry id="systemd.path">
27 <title>systemd.path</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd.path</refentrytitle>
42 <manvolnum>5</manvolnum>
46 <refname>systemd.path</refname>
47 <refpurpose>systemd path configuration files</refpurpose>
51 <para><filename>systemd.path</filename></para>
55 <title>Description</title>
57 <para>A unit configuration file whose name ends in
58 <filename>.path</filename> encodes information about
59 a path monitored by systemd, for
60 path-based activation.</para>
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>
71 <para>For each path file, a matching unit file must
72 exist, describing the unit to activate when the path
73 changes. By default, a service by the same name as the
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>
80 <para>Internally, path units use the
81 <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>
82 API to monitor file systems. Due to that, it suffers by the
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>
87 <para>If an path unit is beneath another mount
88 point in the file system hierarchy, a dependency
89 between both units is created automatically.</para>
91 <para>Unless <varname>DefaultDependencies=</varname>
92 is set to <option>false</option>, path units will
93 implicitly have dependencies of type
94 <varname>Conflicts=</varname> and
95 <varname>Before=</varname> on
96 <filename>shutdown.target</filename>. These ensure
97 that path units are terminated cleanly prior to system
98 shutdown. Only path units involved with early boot or
99 late system shutdown should disable this
104 <title>Options</title>
106 <para>Path files must include a [Path] section,
107 which carries information about the path(s) it
108 monitors. The options specific to the [Path] section
109 of path units are the following:</para>
113 <term><varname>PathExists=</varname></term>
114 <term><varname>PathExistsGlob=</varname></term>
115 <term><varname>PathChanged=</varname></term>
116 <term><varname>PathModified=</varname></term>
117 <term><varname>DirectoryNotEmpty=</varname></term>
119 <listitem><para>Defines paths to
120 monitor for certain changes:
121 <varname>PathExists=</varname> may be
122 used to watch the mere existence of a
123 file or directory. If the file
124 specified exists the configured unit
126 activated. <varname>PathExistsGlob=</varname>
127 works similar, but checks for the
128 existence of at least one file
129 matching the globbing pattern
130 specified. <varname>PathChanged=</varname>
131 may be used to watch a file or
132 directory and activate the configured
133 unit whenever it changes. It is not activated
134 on every write to the watched file but it is
135 activated if the file which was open for writing
136 gets closed. <varname>PathModified=</varname>
137 is similar, but additionally it is activated
138 also on simple writes to the watched file.
140 <varname>DirectoryNotEmpty=</varname>
141 may be used to watch a directory and
142 activate the configured unit whenever
143 it contains at least one file.</para>
145 <para>The arguments of these
146 directives must be absolute file
149 <para>Multiple directives may be
150 combined, of the same and of different
151 types, to watch multiple paths.</para>
153 <para>If a path is already existing
155 <varname>PathExists=</varname> and
156 <varname>PathExistsGlob=</varname>) or
157 a directory already is not empty (in
159 <varname>DirectoryNotEmpty=</varname>)
160 at the time the path unit is
161 activated, then the configured unit is
162 immediately activated as
163 well. Something similar does not apply
164 to <varname>PathChanged=</varname>.
168 <term><varname>Unit=</varname></term>
170 <listitem><para>The unit to activate
171 when any of the configured paths
172 changes. The argument is a unit name,
174 <filename>.path</filename>. If not
175 specified, this value defaults to a
176 service that has the same name as the
177 path unit, except for the suffix. (See
178 above.) It is recommended that the
179 unit name that is activated and the
180 unit name of the path unit are named
181 identical, except for the
182 suffix.</para></listitem>
185 <term><varname>MakeDirectory=</varname></term>
187 <listitem><para>Takes a boolean
188 argument. If true the directories to
189 watch are created before
190 watching. This option is ignored for
191 <varname>PathExists=</varname>
192 settings. Defaults to
193 <option>false</option>.</para></listitem>
196 <term><varname>DirectoryMode=</varname></term>
199 <varname>MakeDirectory=</varname> is
200 enabled use the mode specified here to
201 create the directories in
202 question. Takes an access mode in
203 octal notation. Defaults to
204 <option>0755</option>.</para></listitem>
210 <title>See Also</title>
212 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
213 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
214 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
215 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
216 <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>