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

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Wed Feb 9 07:11:42 UTC 2022


 >>> Tony Rodriguez <unixpro1970 at gmail.com> schrieb am 09.02.2022 um 02:27 in
Nachricht <e8a7bcb0-1f80-475f-150a-e41d2cf5d51f at gmail.com>:
> 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.

The real mess is that a traditional mount works as soon as you have modified /etc/fstab. With systemd there are generators that convert fstab to units, and the generators have to be triggered, and the new units have to be read.
This is a simple example how things can be made more complicated to use and understand.

> 
> Unsure how to do so inside a systemd UNIT.  Will someone please provide 
> an example how to do so?

I had a similar scenario, but the idea of a unit triggering a generator that does reload the daemon in turn, just to be able to use the units that were created by the generator is just some unreliable mess (compared to LSB scripts where you simply started the script and all was fine).

Regards,
Ulrich

> 
> Thanks






More information about the systemd-devel mailing list