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

Honza Horak hhorak at redhat.com
Wed Aug 3 00:30:41 PDT 2011


On 08/02/2011 01:06 AM, Lennart Poettering wrote:
> 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?

mysql has a very specific way of handling configuration, there is a 
script which parses several files.. And user's socket path can be set 
differently in these files, so I just wanted to respect their settings.

However, we don't ship a socket file right now, so this issue isn't 
actual anymore.

Honza

>> 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
>



More information about the systemd-devel mailing list