[systemd-devel] What is wrong with my .path setup?

Mantas Mikulėnas grawity at gmail.com
Sun Mar 20 21:32:00 UTC 2022


On Sun, Mar 20, 2022, 23:27 John Ioannidis <systemd-devel at tla.org> wrote:

> Here are my .path and .service files:
>
> $ *cat /etc/systemd/system/trigg.path *
> [Path]
> DirectoryNotEmpty=/root/trigger
> MakeDirectory=true
>
> $ *cat /etc/systemd/system/trigg.service *
> [Unit]
> Description=Trigger Service
>
> [Service]
> ExecStart=/usr/bin/touch /root/wastriggered
> Type=oneshot
>
>
> Now, after robooting, I would have expected that /root/trigger would
> exist; it does not. And, of course, creating it manually and touching a
> file in there does not trigger the path.
>
> What am I missing? I have successfully used .path units in the past, and
> what I'm doing here looks right; unfortunately I do not have access to
> those old machines any more (previous employer).
>

Seems like there's nothing that would activate your .path unit itself –
path watches or timer schedules are only established while the .path or the
.timer is "started". So you will usually need:

[Install]
WantedBy=paths.target

and the corresponding 'systemctl enable'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220320/f3f5df2e/attachment.htm>


More information about the systemd-devel mailing list