[systemd-devel] How to compute a value for a service argument or environment value?
Alan Stern
stern at rowland.harvard.edu
Wed Mar 19 08:36:06 PDT 2014
On Wed, 19 Mar 2014, Umut Tezduyar wrote:
> Hi Alan,
>
> As Cristian has suggested, the correct behavior is letting daemons
> pick up the right argument.
Cristian must not have CC'ed me on his reply, because I didn't see it
until I looked at the mailing list archive.
> Though, there is a hack if you can't re implement the daemon. You
Right; if you can re-implement the service daemon then obviously you
can make it compute any value it needs.
> could compute the variables in an ExecStartPre= and write them to a
> file (/run/yourservice/arg) and point your
> EnvironmentFile=/run/yourservice/arg. Hope it helps.
That's an interesting suggestion. But the systemd documentation
doesn't guarantee that it will work.
That is, the man page for systemd.exec merely says that files listed in
EnvironmentFile= directives will be read "shortly before the process is
executed". It doesn't say whether "shortly before" means before or
after the ExecStartPre= processes are run. The man page for
systemd.service doesn't address this point either.
Alan Stern
More information about the systemd-devel
mailing list