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 . 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.
On 07/06/2018 12:35 PM, Naik Kaxil wrote:
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.
2nd Floor, Nova South
160 Victoria Street, Westminster
London SW1E 5LB - UK
phone: +44 (0)20 7730 6000