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 files must include a [Path] section, which carries information
68 about the path(s) it monitors. The options specific to the [Path]
69 section of path units are the following:
70
71 PathExists=, PathExistsGlob=, PathChanged=, PathModified=,
72 DirectoryNotEmpty=
73 Defines paths to monitor for certain changes: PathExists= may be
74 used to watch the mere existence of a file or directory. If the
75 file specified exists, the configured unit is activated.
76 PathExistsGlob= works similar, but checks for the existence of at
77 least one file matching the globbing pattern specified.
78 PathChanged= may be used to watch a file or directory and activate
79 the configured unit whenever it changes. It is not activated on
80 every write to the watched file but it is activated if the file
81 which was open for writing gets closed. PathModified= is similar,
82 but additionally it is activated also on simple writes to the
83 watched file. DirectoryNotEmpty= may be used to watch a directory
84 and activate the configured unit whenever it contains at least one
85 file.
86
87 The arguments of these directives must be absolute file system
88 paths.
89
90 Multiple directives may be combined, of the same and of different
91 types, to watch multiple paths. If the empty string is assigned to
92 any of these options, the list of paths to watch is reset, and any
93 prior assignments of these options will not have any effect.
94
95 If a path already exists (in case of PathExists= and
96 PathExistsGlob=) or a directory already is not empty (in case of
97 DirectoryNotEmpty=) at the time the path unit is activated, then
98 the configured unit is immediately activated as well. Something
99 similar does not apply to PathChanged= and PathModified=.
100
101 If the path itself or any of the containing directories are not
102 accessible, systemd will watch for permission changes and notice
103 that conditions are satisfied when permissions allow that.
104
105 Unit=
106 The unit to activate when any of the configured paths changes. The
107 argument is a unit name, whose suffix is not ".path". If not
108 specified, this value defaults to a service that has the same name
109 as the path unit, except for the suffix. (See above.) It is
110 recommended that the unit name that is activated and the unit name
111 of the path unit are named identical, except for the suffix.
112
113 MakeDirectory=
114 Takes a boolean argument. If true, the directories to watch are
115 created before watching. This option is ignored for PathExists=
116 settings. Defaults to false.
117
118 DirectoryMode=
119 If MakeDirectory= is enabled, use the mode specified here to create
120 the directories in question. Takes an access mode in octal
121 notation. Defaults to 0755.
122
124 systemd(1), systemctl(1), systemd.unit(5), systemd.service(5),
125 inotify(7), systemd.directives(7)
126
127
128
129systemd 245 SYSTEMD.PATH(5)