1SYSTEMD.PATH(5) systemd.path SYSTEMD.PATH(5)
2
3
4
6 systemd.path - Path unit configuration
7
9 path.path
10
12 A unit configuration file whose name ends in ".path" encodes
13 information about a path monitored by systemd, for path-based
14 activation.
15
16 This man page lists the configuration options specific to this unit
17 type. See systemd.unit(5) for the common options of all unit
18 configuration files. The common configuration items are configured in
19 the generic [Unit] and [Install] sections. The path specific
20 configuration options are configured in the [Path] section.
21
22 For each path file, a matching unit file must exist, describing the
23 unit to activate when the path changes. By default, a service by the
24 same name as the path (except for the suffix) is activated. Example: a
25 path file foo.path activates a matching service foo.service. The unit
26 to activate may be controlled by Unit= (see below).
27
28 Internally, path units use the inotify(7) API to monitor file systems.
29 Due to that, it suffers by the same limitations as inotify, and for
30 example cannot be used to monitor files or directories changed by other
31 machines on remote NFS file systems.
32
33 When a service unit triggered by a path unit terminates (regardless
34 whether it exited successfully or failed), monitored paths are checked
35 immediately again, and the service accordingly restarted instantly. As
36 protection against busy looping in this trigger/start cycle, a start
37 rate limit is enforced on the service unit, see StartLimitIntervalSec=
38 and StartLimitBurst= in systemd.unit(5). Unlike other service failures,
39 the error condition that the start rate limit is hit is propagated from
40 the service unit to the path unit and causes the path unit to fail as
41 well, thus ending the loop.
42
44 Implicit Dependencies
45 The following dependencies are implicitly added:
46
47 • If a path unit is beneath another mount unit in the file system
48 hierarchy, both a requirement and an ordering dependency between
49 both units are created automatically.
50
51 • An implicit Before= dependency is added between a path unit and the
52 unit it is supposed to activate.
53
54 Default Dependencies
55 The following dependencies are added unless DefaultDependencies=no is
56 set:
57
58 • Path units will automatically have dependencies of type Before= on
59 paths.target, dependencies of type After= and Requires= on
60 sysinit.target, and have dependencies of type Conflicts= and
61 Before= on shutdown.target. These ensure that path units are
62 terminated cleanly prior to system shutdown. Only path units
63 involved with early boot or late system shutdown should disable
64 DefaultDependencies= option.
65
67 Path unit files may include [Unit] and [Install] sections, which are
68 described in systemd.unit(5).
69
70 Path unit files must include a [Path] section, which carries
71 information about the path or paths it monitors. The options specific
72 to the [Path] section of path units are the following:
73
74 PathExists=, PathExistsGlob=, PathChanged=, PathModified=,
75 DirectoryNotEmpty=
76 Defines paths to monitor for certain changes: PathExists= may be
77 used to watch the mere existence of a file or directory. If the
78 file specified exists, the configured unit is activated.
79 PathExistsGlob= works similarly, but checks for the existence of at
80 least one file matching the globbing pattern specified.
81 PathChanged= may be used to watch a file or directory and activate
82 the configured unit whenever it changes. It is not activated on
83 every write to the watched file but it is activated if the file
84 which was open for writing gets closed. PathModified= is similar,
85 but additionally it is activated also on simple writes to the
86 watched file. DirectoryNotEmpty= may be used to watch a directory
87 and activate the configured unit whenever it contains at least one
88 file.
89
90 The arguments of these directives must be absolute file system
91 paths.
92
93 Multiple directives may be combined, of the same and of different
94 types, to watch multiple paths. If the empty string is assigned to
95 any of these options, the list of paths to watch is reset, and any
96 prior assignments of these options will not have any effect.
97
98 If a path already exists (in case of PathExists= and
99 PathExistsGlob=) or a directory already is not empty (in case of
100 DirectoryNotEmpty=) at the time the path unit is activated, then
101 the configured unit is immediately activated as well. Something
102 similar does not apply to PathChanged= and PathModified=.
103
104 If the path itself or any of the containing directories are not
105 accessible, systemd will watch for permission changes and notice
106 that conditions are satisfied when permissions allow that.
107
108 Unit=
109 The unit to activate when any of the configured paths changes. The
110 argument is a unit name, whose suffix is not ".path". If not
111 specified, this value defaults to a service that has the same name
112 as the path unit, except for the suffix. (See above.) It is
113 recommended that the unit name that is activated and the unit name
114 of the path unit are named identical, except for the suffix.
115
116 MakeDirectory=
117 Takes a boolean argument. If true, the directories to watch are
118 created before watching. This option is ignored for PathExists=
119 settings. Defaults to false.
120
121 DirectoryMode=
122 If MakeDirectory= is enabled, use the mode specified here to create
123 the directories in question. Takes an access mode in octal
124 notation. Defaults to 0755.
125
126 TriggerLimitIntervalSec=, TriggerLimitBurst=
127 Configures a limit on how often this path unit may be activated
128 within a specific time interval. The TriggerLimitIntervalSec= may
129 be used to configure the length of the time interval in the usual
130 time units "us", "ms", "s", "min", "h", ... and defaults to 2s. See
131 systemd.time(7) for details on the various time units understood.
132 The TriggerLimitBurst= setting takes a positive integer value and
133 specifies the number of permitted activations per time interval,
134 and defaults to 200. Set either to 0 to disable any form of trigger
135 rate limiting. If the limit is hit, the unit is placed into a
136 failure mode, and will not watch the paths anymore until restarted.
137 Note that this limit is enforced before the service activation is
138 enqueued.
139
140 Check systemd.unit(5), systemd.exec(5), and systemd.kill(5) for more
141 settings.
142
144 Environment variables with details on the trigger will be set for
145 triggered units. See the section "Environment Variables Set or
146 Propagated by the Service Manager" in systemd.exec(5) for more details.
147
148 systemd(1), systemctl(1), systemd.unit(5), systemd.service(5),
149 inotify(7), systemd.directives(7)
150
151
152
153systemd 253 SYSTEMD.PATH(5)