[systemd-devel] I want to use an environmental variable for LimitNOFILE= in a service unit. Is it possible?

Lennart Poettering lennart at poettering.net
Thu Sep 3 08:35:47 PDT 2015


On Thu, 03.09.15 17:45, Eliezer Croitoru (eliezer at ngtech.co.il) wrote:

> Hey,
> 
> I am working on a service for squid caching service.
> I have a need to define LimitNOFILE from an environmental variable instead
> of only the service file.

No this does not work. Environment expansion is only done for
ExecStart= and related lines, and the environment is only determined
right when the binary is invoked.

Generally: configuration for units is supposed to be placed in units,
Splitting that into environment files such as /etc/sysconfig/* makes
things both more opaque for the admin and harder to process from
applications reading unit files. Hence, your usecase is explicitly
something we don't recommend.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list