<html><head></head><body><div class="ydp11e8a10eyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div dir="ltr" data-setdir="false">Hello,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0"><span>Thank you for your really appreciated advice.</span></span></span> <br></div><div dir="ltr" data-setdir="false"><span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0"><span>I confirm that I misunderstood</span></span></span> what "applies to all instances" means.</div><div dir="ltr" data-setdir="false">So now seems clear. Thanks</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">But there is something I don't understand.<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I have two templates.</div><div dir="ltr" data-setdir="false">The second one which is a simple instance of a tail > /dev/ttyX under tail@.service</div><div dir="ltr" data-setdir="false">I renamed it to foo@.service (I don't have something which have foo* or bar* as name and previous tail@.service doesn't not exist anymore)<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I have this [Install] Section:</div><div dir="ltr" data-setdir="false">WantedBy=getty.target</div><div dir="ltr" data-setdir="false">DefaultInstance=tty12</div><div dir="ltr" data-setdir="false">Alias=bar@.service</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">systemctl enable foo@tty12.service</div><div dir="ltr" data-setdir="false">> Created symlink /etc/systemd/system/bar@tty12.service => /etc/systemd/system/foo@.service</div><div dir="ltr" data-setdir="false">> Created symlink /etc/systemd/system/getty.target.wants/foo@tty12.service => /etc/systemd/system/foo@service</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Systemctl status bar@tty12.service</div><div dir="ltr" data-setdir="false">> Loaded: error (Reason: Unit bar@tty12.service to load properly: File Exists)</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Systemctl start bar@tty12.service = KO</div><div dir="ltr" data-setdir="false">> Failed to start bar@tty12.service: Unit bar@tty12.service failed to load properly: File Exists.</div><div dir="ltr" data-setdir="false">> See system logs and systemctl status bar@tty12.service for details</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Systemctl start foo@tty12.service = OK</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Regards</div><div dir="ltr" data-setdir="false">Hans<br></div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
        
        </div><div id="ydp7c7e206cyahoo_quoted_9811268532" class="ydp7c7e206cyahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    Le jeudi 22 avril 2021 à 20:49:52 UTC+2, Mantas Mikulėnas <grawity@gmail.com> a écrit :
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydp7c7e206cyiv2322378640"><div><div dir="ltr"><div class="ydp7c7e206cyiv2322378640yqt6201725153" id="ydp7c7e206cyiv2322378640yqtfd29864"><div dir="ltr">On Thu, Apr 22, 2021 at 9:18 PM Hans Gruber <<a shape="rect" href="mailto:moocan2112@yahoo.fr" rel="nofollow" target="_blank">moocan2112@yahoo.fr</a>> wrote:<br clear="none"></div></div><div class="ydp7c7e206cyiv2322378640gmail_quote"><blockquote class="ydp7c7e206cyiv2322378640gmail_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, Arial, sans-serif;font-size:13px;"><div class="ydp7c7e206cyiv2322378640yqt6201725153" id="ydp7c7e206cyiv2322378640yqtfd92961"><div dir="ltr">Hello,</div><div dir="ltr"><br clear="none"></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 clear="none"></div><div dir="ltr">According to <a shape="rect" href="https://www.freedesktop.org/software/systemd/man/systemd.unit.html" rel="nofollow" target="_blank">https://www.freedesktop.org/software/systemd/man/systemd.unit.html</a><br clear="none"></div><div dir="ltr"><br clear="none"></div></div><div dir="ltr"><div class="ydp7c7e206cyiv2322378640yqt6201725153" id="ydp7c7e206cyiv2322378640yqtfd32406"><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 clear="none"></div><div dir="ltr">I have exactly these two cases and requirements and cannot find example.</div><div dir="ltr"><br clear="none"></div></div><div dir="ltr"><div class="ydp7c7e206cyiv2322378640yqt6201725153" id="ydp7c7e206cyiv2322378640yqtfd88053">>  "A template may be aliased by another template (in which case the alias applies to all instances of the template)"<br clear="none"><br clear="none">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.</div><br clear="none"></div></div></div></div></blockquote><div><br clear="none"></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 clear="none"></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 clear="none"></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 clear="none"></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 clear="none"></div>-- <br clear="none"><div class="ydp7c7e206cyiv2322378640gmail_signature" dir="ltr"><div dir="ltr">Mantas Mikulėnas</div></div></div><div class="ydp7c7e206cyiv2322378640yqt6201725153" id="ydp7c7e206cyiv2322378640yqtfd41756">
</div></div></div></div>
            </div>
        </div></body></html>