[systemd-devel] Query regarding "EnvironmentFile"

Soumya Koduri skoduri at redhat.com
Wed Dec 9 04:57:57 PST 2015


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



My intention is to execute/start nfs-ganesha-config.service always prior 
to running nfs-ganesha.service (even during restart).

nfs-ganesha-config.service writes certain configuration values to 
'/run/sysconfig/ganesha' which I would want nfs-ganesha.service to read 
before starting ganesha.nfsd daemon.

But from my tests I see that nfs-ganesha.service picks up old 
configuration values defined in '/run/sysconfig/ganesha' than the ones 
generated by 'nfs-ganesha-config.service' at that point. So I am 
assuming 'EnvironmentFile' gets loaded prior to running any dependent 
services (which is 'nfs-ganesha-config.service' here).

Please confirm if that is the case. Also is there any way to load 
'EnvironmentFile' only after executing all the dependent services.

Thanks,
Soumya


More information about the systemd-devel mailing list