On Wed, 31.10.12 14:28, Honza Horak ([email protected]) wrote: > Hi systemd hackers, > > I'm wondering when exactly EnvironmentFile is read during service > start.
Shortly before process execution (which is actually documented in systemd.exec(5)). Process execution means that it will be reloaded on each ExecXYZ= directive. > 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? I don't think that pressing things into EnvironmentFile= in this case is necessarily a good idea. It's OK to wrap things in a shell script if the daemon code internally is not sufficient to set up the execution environment. Make sure to ultimately use "exec" to start the real binary from such a script (rather than have it running as a subprocess). Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
