Re: [systemd-devel] How to source a variable file using systemd

2015-10-28 Thread Soumya Koduri
Thank you so much for your inputs. -Soumya On 10/27/2015 05:49 PM, Lennart Poettering wrote: On Tue, 27.10.15 16:05, Soumya Koduri (skod...@redhat.com) wrote: Hi, We have a use-case where in we have to read an environment variable (say ${MY_ENV_FILE}) from a file (say /etc/myconfig) and

Re: [systemd-devel] How to source a variable file using systemd

2015-10-27 Thread Richard Maw
On Tue, Oct 27, 2015 at 04:05:18PM +0530, Soumya Koduri wrote: > EnvironmentFile=/etc/myconfig > > ExecStart=/bin/bash -c 'source ${MY_ENV_FILE} && echo ${MY_ENV_VAR}' Systemd also does shell-like variable substitution, so potentially it's decided to interpolate in the value of $MY_ENV_VAR

[systemd-devel] How to source a variable file using systemd

2015-10-27 Thread Soumya Koduri
Hi, We have a use-case where in we have to read an environment variable (say ${MY_ENV_FILE}) from a file (say /etc/myconfig) and source ${MY_ENV_FILE} to read yet another environment variable (say ${MY_ENV_VAR} in our systemd service file. I first tried out below --

Re: [systemd-devel] How to source a variable file using systemd

2015-10-27 Thread Mantas Mikulėnas
On Tue, Oct 27, 2015 at 12:35 PM, Soumya Koduri wrote: > Hi, > > We have a use-case where in we have to read an environment variable (say > ${MY_ENV_FILE}) from a file (say /etc/myconfig) and source ${MY_ENV_FILE} > to read yet another environment variable (say ${MY_ENV_VAR}

Re: [systemd-devel] How to source a variable file using systemd

2015-10-27 Thread Lennart Poettering
On Tue, 27.10.15 16:05, Soumya Koduri (skod...@redhat.com) wrote: > Hi, > > We have a use-case where in we have to read an environment variable (say > ${MY_ENV_FILE}) from a file (say /etc/myconfig) and source ${MY_ENV_FILE} to > read yet another environment variable (say ${MY_ENV_VAR} in our

Re: [systemd-devel] How to source a variable file using systemd

2015-10-27 Thread Soumya Koduri
Thanks Richard & Mantas. That did the trick. -Soumya On 10/27/2015 04:11 PM, Richard Maw wrote: On Tue, Oct 27, 2015 at 04:05:18PM +0530, Soumya Koduri wrote: EnvironmentFile=/etc/myconfig ExecStart=/bin/bash -c 'source ${MY_ENV_FILE} && echo ${MY_ENV_VAR}' Systemd also does