How to pass custom environment variable in systemd unit file ?
Issue
-
Unable to pass custom environment variable in systemd unit file definition.
Environment="VAR1=VALUE1" Environment="VAR2=$VAR1 VALUE2"
-
The variable
$VAR1
does not get resolved with correct value (VALUE1). -
Use of
EnvironmentFile
did not resolve the value of the environment variable$VAR1
.
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Systemd
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.