<div dir="ltr"><div dir="ltr">On Thu, Apr 22, 2021 at 9:18 PM Hans Gruber <<a href="mailto:moocan2112@yahoo.fr">moocan2112@yahoo.fr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><div dir="ltr">Hello,</div><div dir="ltr"><br></div><div dir="ltr"><span lang="en"><span><span>I am having problems with the aliases and "Alias=' directive related to the template service unit.</span></span></span></div><div dir="ltr"><br></div><div dir="ltr">According to <a href="https://www.freedesktop.org/software/systemd/man/systemd.unit.html" target="_blank">https://www.freedesktop.org/software/systemd/man/systemd.unit.html</a><br></div><div dir="ltr"><br></div><div dir="ltr"><div>> "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. "alias@inst.service") may be a symlink to different template (e.g. "template@inst.service"). In that case, just this specific instance is aliased, while other instances of the template (e.g. "alias@foo.service", "alias@bar.service") 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."</div><div><br></div><div dir="ltr">I have exactly these two cases and requirements and cannot find example.</div><div dir="ltr"><br></div><div dir="ltr">>  "A template may be aliased by another template (in which case the alias applies to all instances of the template)"<br><br>eg: How to create an alias using `Alias=` for a service template core@.service which will have maybe 8 or 16 instances (eg: core@cpu01.service core@cpu02.service ..) which will apply to all instances when enabled using eg allcores@.service.<br></div></div></div></div></blockquote><div><br></div><div>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*.</div><div><br></div><div>But one instance is still aliased to one instance. For example, if you alias foo@.service => bar@.service, then you automatically get foo@cpu1.service => bar@cpu1.service, and so on. That's what template aliases do.</div><div><br></div><div>If you want to control multiple instances at once, you might be looking for two other features:</div><div>1. Custom target units, which allow you to *start* all instances at once;<br></div><div>2. Wildcard support in `systemctl` commands, which allows you to see the status of all loaded instances at once (systemctl status "foo@*.service").</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>