Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dropin: when looking for dropins for a unit, also look within "-" pre…
…fix unit dirs This extends the logic by which we look for drop-ins for unit files when loading them. Previously for a unit "foo-quux-bar.service" we'd look in a directory "foo-quux-bar.service.d" accompanying it for extension dropins. With this change we'll additionally look in: "foo-quux-.service.d" and "foo-.service.d", i.e. we'll truncate the unit name after every dash. This is an alternative to templating for many services, as it permits configuring defaults for sets of units that all use the same prefix in the unit name. This is particularly useful in slice, mount and automount units which reflect a hierarchy of concepts, as it permits setting defaults for specific subsets of the tree. For example, in order to provide every user with a memory of 1G it's now possible to do: # mkdir -p /etc/systemd/system/user-.slice.d # cat > /etc/systemd/system/user-.slice.d/50-memory.conf << EOF [Slice] MemoryMax=1G EOF # systemctl daemon-reload This makes use of the fact that every user gets his own slice unit when logging in, named "user-$UID.slice". This doesn't precisely provide what is requested in systemd#2556, but it does provide equivalent functionality. Fixes: systemd#2556 See: systemd#3504 systemd#7599
- Loading branch information