[systemd-devel] assign variable to some service item

Lennart Poettering lennart at poettering.net
Wed Oct 5 15:00:43 UTC 2016


On Thu, 29.09.16 11:25, Vasiliy Tolstov (v.tolstov at selfip.ru) wrote:

> I have CPUAffinity inside service file and want to configure it via
> EnvironmentFile, but
> CPUAffinity=$CPUAffinity does not work with message Failed to parse
> CPU affinity '$CPUAffinity'
> Environment file contains CPUAffinity="0-2"
> Does it possible to assign cpu affinity via env variable ?

No, this is not available. Unit file syntax is intentionally kept
simple, so that simple tools can parse them without having to
implement a macro language.

The various ExecXYZ= switches are an exception: you may reference env
vars in the specified command lines and they are resolved at the time
of invocation.

(Well, at least that's the idea. In fact, even though this is the goal
a couple of features crept in I think we should better have avoided.)

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list