[systemd-devel] Query regarding "EnvironmentFile"

Michael Biebl mbiebl at gmail.com
Fri Dec 18 08:00:32 PST 2015


2015-12-09 20:46 GMT+01:00 Lennart Poettering <lennart at poettering.net>:
> On Wed, 09.12.15 18:27, Soumya Koduri (skoduri at redhat.com) wrote:
>
>> Hi,
>>
>> I have created a systemd.unit(nfs-ganesha.service) file as below :
>>
>> [Unit]
>>
>> After=nfs-ganesha-config.service
>> Requires=nfs-ganesha-config.service
>> ....
>>
>> [Service]
>> EnvironmentFile=-/run/sysconfig/ganesha
>> ExecStart=/usr/bin/ganesha.nfsd $OPTIONS ${EPOCH}
>
> (But honestly, there's really no point in trying to dynamically
> convert stuff into a file that is suitable for EnvironmentFile=. I
> mean, if you want a shell script, then use a shell script, and invoke
> that from the main daemon's ExecStart= line, and make it exec the real
> daemon as last step. There's really no point in playing these
> multi-service conversion games. Also /etc/sysconfig is a Redhatism
> that should really go away, the whole concept is flawed. Adding a new
> /run/sysconfig/ certainly makes that even worse.)
>
> I probably should never have added EnvironmentFile= in the first
> place. Packagers misunderstand that unit files are subject to admin
> configuration and should be treated as such, and that spliting out
> configuration of unit files into separate EnvironmentFiles= is a
> really non-sensical game of unnecessary indirection.

I do think that overriding the complete ExecStart= line is usually
suboptimal and not what you want if you just want to pass additional
options to the daemon.

Maybe a good middle ground / recommendation for such daemons would be,
to ship a line

ExecStart=/usr/sbin/foobard $OPTS

and then tell admin to use systemctl edit
[Unit]
Environment=OPTS=-baz

bonus points if we could standardise the $OPTS var name across daemons.

Then distros like Fedora could do a one-time migration of their
settings in /etc/sysconfig/foobar and drop the file after the upgrade.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


More information about the systemd-devel mailing list