1

I have multiple .socket files, they listen with Accept=yes. They should all use the same service template to process connections. By default systemd looks for a service template with the same name as the socket, but as I have multiple socket files I would like to all point them to the same service template.

There is a setting Service= but that only accepts non-template services and requires Accept=no. Is there any way to specify the service template to invoke from the .socket unit?

2

No. The derivation of the service unit name from the socket unit name is hardwired in the code of systemd, and not configurable.

That said, you can probably get by with linking the single service unit file to multiple filenames. (Ordinary linking, that is. Symbolic links are interpreted explicitly by systemd and there's a risk of them not doing what you would expect from ordinary filesystem semantics.)

Also note that you can have multiple "listens" in a single socket unit. (Yes, you probably have good reasons for not doing this, including a desire to be able to individually enable/disable sockets. But I mention it just in case.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.