On Thu, Apr 22, 2021 at 9:18 PM Hans Gruber <[email protected]> wrote:
> Hello, > > I am having problems with the aliases and "Alias=' directive related to > the template service unit. > > According to > https://www.freedesktop.org/software/systemd/man/systemd.unit.html > > > "A template instance may only be aliased by another template instance, > and the instance part must be identical. A template may be aliased by > another template (in which case the alias applies to all instances of the > template). As a special case, a template instance (e.g. "[email protected]") > may be a symlink to different template (e.g. "[email protected]"). In > that case, just this specific instance is aliased, while other instances of > the template (e.g. "[email protected]", "[email protected]") are not > aliased. Those rule preserve the requirement that the instance (if any) is > always uniquely defined for a given unit and all its aliases." > > I have exactly these two cases and requirements and cannot find example. > > > "A template may be aliased by another template (in which case the alias > applies to all instances of the template)" > > eg: How to create an alias using `Alias=` for a service template [email protected] > which will have maybe 8 or 16 instances (eg: [email protected] > [email protected] ..) which will apply to all instances when enabled > using eg [email protected]. > I think you're misunderstanding what "applies to all instances" means. It does not give you a super-unit that controls all instances in unison -- rather, it gives you a template alias that will provide an alias for *each instance individually*. But one instance is still aliased to one instance. For example, if you alias [email protected] => [email protected], then you automatically get [email protected] => [email protected], and so on. That's what template aliases do. If you want to control multiple instances at once, you might be looking for two other features: 1. Custom target units, which allow you to *start* all instances at once; 2. Wildcard support in `systemctl` commands, which allows you to see the status of all loaded instances at once (systemctl status "foo@*.service"). -- Mantas Mikulėnas
_______________________________________________ systemd-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/systemd-devel
