[systemd-devel] EnvironmentFile generated during ExecStartPre phase

Honza Horak hhorak at redhat.com
Wed Oct 31 06:28:10 PDT 2012


Hi systemd hackers,

I'm wondering when exactly EnvironmentFile is read during service start.

My use case is the following: the service should be started with some 
environment variables defined, but the variable values are not static, 
but rather dynamically generated using some script. This could be solved 
by using EnvironmentFile=-/var/run/myservice, while this file would be 
generated in ExecStartPre=/usr/libexec/myservice-gen-env.

I did some quick testing and it seems EnvironmentFile is read before 
*every* ExecStart*. Is this something I can rely on?

Cheers,
Honza


More information about the systemd-devel mailing list