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
34 Implicit Dependencies
35 The following dependencies are implicitly added:
36
37 · If a path unit is beneath another mount unit in the file system
38 hierarchy, both a requirement and an ordering dependency between
39 both units are created automatically.
40
41 · An implicit Before= dependency is added between a path unit and the
42 unit it is supposed to activate.
43
44 Default Dependencies
45 The following dependencies are added unless DefaultDependencies=no is
46 set:
47
48 · Path units will automatically have dependencies of type Before= on
49 paths.target, dependencies of type After= and Requires= on
50 sysinit.target, and have dependencies of type Conflicts= and
51 Before= on shutdown.target. These ensure that path units are
52 terminated cleanly prior to system shutdown. Only path units
53 involved with early boot or late system shutdown should disable
54 DefaultDependencies= option.
55
57 Path files must include a [Path] section, which carries information
58 about the path(s) it monitors. The options specific to the [Path]
59 section of path units are the following:
60
61 PathExists=, PathExistsGlob=, PathChanged=, PathModified=,
62 DirectoryNotEmpty=
63 Defines paths to monitor for certain changes: PathExists= may be
64 used to watch the mere existence of a file or directory. If the
65 file specified exists, the configured unit is activated.
66 PathExistsGlob= works similar, but checks for the existence of at
67 least one file matching the globbing pattern specified.
68 PathChanged= may be used to watch a file or directory and activate
69 the configured unit whenever it changes. It is not activated on
70 every write to the watched file but it is activated if the file
71 which was open for writing gets closed. PathModified= is similar,
72 but additionally it is activated also on simple writes to the
73 watched file. DirectoryNotEmpty= may be used to watch a directory
74 and activate the configured unit whenever it contains at least one
75 file.
76
77 The arguments of these directives must be absolute file system
78 paths.
79
80 Multiple directives may be combined, of the same and of different
81 types, to watch multiple paths. If the empty string is assigned to
82 any of these options, the list of paths to watch is reset, and any
83 prior assignments of these options will not have any effect.
84
85 If a path already exists (in case of PathExists= and
86 PathExistsGlob=) or a directory already is not empty (in case of
87 DirectoryNotEmpty=) at the time the path unit is activated, then
88 the configured unit is immediately activated as well. Something
89 similar does not apply to PathChanged= and PathModified=.
90
91 If the path itself or any of the containing directories are not
92 accessible, systemd will watch for permission changes and notice
93 that conditions are satisfied when permissions allow that.
94
95 Unit=
96 The unit to activate when any of the configured paths changes. The
97 argument is a unit name, whose suffix is not ".path". If not
98 specified, this value defaults to a service that has the same name
99 as the path unit, except for the suffix. (See above.) It is
100 recommended that the unit name that is activated and the unit name
101 of the path unit are named identical, except for the suffix.
102
103 MakeDirectory=
104 Takes a boolean argument. If true, the directories to watch are
105 created before watching. This option is ignored for PathExists=
106 settings. Defaults to false.
107
108 DirectoryMode=
109 If MakeDirectory= is enabled, use the mode specified here to create
110 the directories in question. Takes an access mode in octal
111 notation. Defaults to 0755.
112
114 systemd(1), systemctl(1), systemd.unit(5), systemd.service(5),
115 inotify(7), systemd.directives(7)
116
117
118
119systemd 239 SYSTEMD.PATH(5)