[systemd-devel] Shell expressions in EnvironmentFile
Dale R. Worley
worley at alum.mit.edu
Tue Oct 7 12:52:08 PDT 2014
> From: Simon Peeters <peeters.simon at gmail.com>
>
> 2014-10-07 19:12 GMT+02:00 Jon Stanley <jonstanley at gmail.com>:
> > [Service]
> > ExecStartPre=/something/that/sets/var
> > ExecStart=/some/file $var
>
> ExecStart=/bin/sh -c ". /something/that/sets/var; /some/file $var"
Yeah, I think some thing like this would work:
ExecStartPre=/bin/sh -c '/something/that/sets/var ; printenv >/tmp/special'
ExecStart=/bin/sh -c '. /tmp/special ; /some/file $var'
But you probably want to reorganize how you're doing the job.
You probably want a wrapper script that calculates $var and then
invokes "/some/file $var".
Dale
More information about the systemd-devel
mailing list