[lug] Environment variable expansion in systemd service files

Davide Del Vento davide.del.vento at gmail.com
Mon Feb 27 06:06:07 MST 2017


I don't know anything about systemd but I've encountered similar issues in
different context.
Often times, the only solution I could come with was pre-processing the
file.

On Sun, Feb 26, 2017 at 8:15 PM, Chris Riddoch <riddochc at gmail.com> wrote:

> I've been trying to figure out how to accomplish something in systemd
> service configuration files, I hope maybe someone else has tried to do
> something similar before and recognizes this.  I've made the following test
> service:
>
> [Unit]
> Description=Environment test
>
> [Service]
> Environment=A=/a/b
> Environment=C=$A/c
> WorkingDirectory=/tmp
> Type=simple
> ExecStart=/bin/echo $C
> StandardOutput=syslog
>
> [Install]
> WantedBy=default.target
>
> I can't seem to get the definition of C to include A, no matter what sort
> of escaping I've tried.  This is, of course, a reduced case - the actual
> situation is one where quite a few environment variables are being defined
> with reference to each other.
>
> Any ideas?
>
> --
> Chris Riddoch
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20170227/db1844f4/attachment.html>


More information about the LUG mailing list