[systemd-devel] systemd | Requires statement with an instantiated service

Andrei Borzenkov arvidjaar at gmail.com
Thu Sep 2 06:00:51 UTC 2021


On 02.09.2021 01:19, Leon Fauster wrote:
> Dear list,
> 
> following requirement exists here (systemd-239 installed):
> 
> Applying a "Requires" statement with an instantiated service.
> 
> Example:
> 
> a at .service
> b.service
> 
> a at .service is started as a at host1.service and b.service must be started
> after a at host1.service but the unit will be differently parameterized
> (depended of the region). So I want to generalize the requires statement.

If you need to manually instantiate a at .service, you can just as well
manually add necessary Requires at the same time. E.g.

a at .service:

[Install]
RequiredBy=b.service

systemctl enable a at your-region.service

> 
> My dropin file in ./b.service.d/dep.conf looks like
> 
> [Unit]
> Requires="a@*.service"
> 
> This just produces following error:
> 'Failed to add dependency on "a@*.service", ignoring: Invalid argument'
> 
> I use also a Before=b.service statement for a at .service but that is not
> enough.
> 

Why?


More information about the systemd-devel mailing list