OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Environment variables not working when using systemd


Because systemd does not read environment files from .bashrc. It has its own way of getting environment files.

Have a look at the systemd unit file doc [1]. Look out for "Environment=" and "EnvironmentFile=" directives.

Another possibility would be to set the env vars systemwide (e.g. in /etc/environment) - this however is distribution-dependent.


[1] https://www.freedesktop.org/software/systemd/man/systemd.service.html


On 07/06/2018 12:35 PM, Naik Kaxil wrote:
Hi guys,

I have recently setup Airflow on a new VM with system integration. I have added some environment variables in my bash_rc file for airflow user. Now when I try to run a BashOperator by first starting airflow using `airflow webserver -D` and `airflow scheduler -D` it seem to have access to that environment variables.

But if I use `systemctl start airflow-webserver`, and run the same operator, there is no output for the same environment variables.

And I am unable to figure out why is that the case.

Regards,

Kaxil



Kaxil Naik

Data Reply
2nd Floor, Nova South
160 Victoria Street, Westminster
London SW1E 5LB - UK
phone: +44 (0)20 7730 6000
k.naik@xxxxxxxxx <mailto:k.naik@xxxxxxxxx>
www.reply.com

Data Reply

--
Andreas Koeltringer
Mail:   andreas.koeltringer@xxxxxxxxx