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