[systemd-devel] environment/configuration in socket unit files

Lennart Poettering lennart at poettering.net
Mon Aug 1 16:06:11 PDT 2011


On Tue, 19.07.11 19:27, Honza Horak (hhorak at redhat.com) wrote:

> Hi,
> 
> I'm creating some systemd unit files for Fedora (currently myslq
> just FYI), but I need to set a socket path in the mydaemon.socket
> unit file according to user's configuration, which is provided by an
> executable.

Hm, waht's the usecase here? Why is that path configurable?

> My intention is to store the generated configuration into a
> temporary file (/usr/lib/mydaemon/config in the following example),
> which has new-line separated values and thus can be used in
> EnvironmentFile.

I can't say I like this idea, but this should work.

> Is it possible to use variables like EnvironmentFile in a socket
> unit files somehow, e.g. like in the following example? systemd
> doesn't complain, but I don't know if it is legal. And what do you
> thing about using a temporary file for storing new-line separated
> values? Do you have a better solution?

Yes, you may use EnvironmentFile, but they only have an effect on
ExecStartXX lines. You cannot resolve env vars in ListenStream=
directives with that.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list