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