[systemd-devel] Accpetance of Environment Variables in Attributes

Lennart Poettering lennart at poettering.net
Thu Jun 25 11:33:39 UTC 2020


On Do, 25.06.20 13:24, Ede Wolf (listac at nebelschwaden.de) wrote:

> So I have an environmentfile containing two variable definitions:
>
> RUNASUSER=nobody
> MEM=4294967296
>
> And my service section reads:
>
> [Service]
> EnvironmentFile=/path/myfile
> User=$RUNASUSER
> LimitMEMLOCK=$MEM

I am not sure what made you think this works, but systemd has no
concept of env var expansion in unit files. It's not a shell.

There's one exception: in ExecXYZ= settings there's env var expansion,
but that's really it. And it's expanded at the moment of execution,
i.e. not part of the unit file language, but of the executor code.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list