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