16.10.2015 17:41, Chris Bell пишет:
Hello,

I currently have a systemd unit that I have to reference a lot which has
a rather long name. I would prefer to be able to reference this unit as
a short alias.

Example: I have a container unit called '[email protected]'
and I would like to be able to refer to it as simply 'sd-gitlab.service'
I've added an override.conf with the following:

[Install]
WantedBy=                       # To clear out previous wantedby params,
though this doesn't seem to work like that. Documentation doesn't say it
should, so I'm not surprised.

Only selected directives can be cleared this way.

Alias=sd-gitlab.service         # I've also tried
Alias=machines.target.wants/gitlab.service and omitted the following
WantedBy decl.
WantedBy=machines.target

When I run enable, it does not make the symlinks:

#systemctl enable [email protected]
Created symlink from
/etc/systemd/system/machines.target.wants/[email protected]
to /etc/systemd/system/[email protected]


However, if I edit the [email protected] base unit file
(systemctl edit --full [email protected]) and change the
Install section to:

[Install]
Alias=gitlab.service          # Only added this one line
WantedBy=machines.target

and enable the service:

#systemctl enable [email protected]
Created symlink from /etc/systemd/system/gitlab.service to
/etc/systemd/system/[email protected].
Created symlink from
/etc/systemd/system/machines.target.wants/[email protected]
to /etc/systemd/system/[email protected].

Is there a way I can have it only enable the alias of the unit? Or do
both have to be enabled?

The problem is that Alias is just a symlink to "primary" unit file. But in case of instantiated template no primary unit file exists at all. So there would really be nothing to link to.

But it seems that even if I create link [email protected] to [email protected] it still wants to enable template, not instantiated unit.

Also, is there any way to specify a unit alias within an override.conf?


Seems to be ignored, at least [Install] section.
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to