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