[systemd-devel] Need a systemd unit example that checks /etc/fstab for modification and sends a text message

Lennart Poettering lennart at poettering.net
Thu Feb 10 12:53:09 UTC 2022


On Di, 08.02.22 17:27, Tony Rodriguez (unixpro1970 at gmail.com) wrote:

> From my understanding, it is frowned by systemd developers to
> "automatically" reload systemd via "systemctl daemon-reload" when /etc/fstab
> is modified.  Guessing this is why such functionality hasn't already been
> incorporated into systemd.  However, I would like to send a simple text
> message. Instructing users to manually invoke "systemctl  deamon-reload"
> after modifying /etc/fstab via dmesg command or inside /var/log/messages.
>
> Unsure how to do so inside a systemd UNIT.  Will someone please provide an
> example how to do so?

At least Fedora puts a comment about this in /etc/fstab, explaining
the situation. Tht sounds a lot more appropriate to me rather then
making this appear in the logs...

You can use a PathModified= .path unit for this if you like.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list