Comment on page
Environment variables
By default, Connect agent runs as a systemd service. Therefore, all system Environment variables are not reachable by the agent and can't be used with Connect tools (Micro-updates, Remote commands, etc..).
To make the Environment variables reachable by the agent, you can load a file that contains those variables to the agent's service configuration. When the file is loaded, you will be able to use your Environment variables in all Connect tools. Follow the next steps to load your Environment variables to Connect agent:
- 1.Create the file (if it doesn't exist)
/etc/environment
- 2.Set your Environment variables at the end of that file:
TEST_ENV="some-value"
- 3.Open the file
/etc/systemd/system/connect.service
and right above the line that begins withExecStart
, enter the line:EnvironmentFile=/etc/environment
- 4.Save and close the file. Then execute the command:
systemctl daemon-reload
- 5.Then execute the command:
systemctl restart connect
From now on, any Environment variable that will be written inside the file
/etc/environment
, will be accessible from Connect tools. (If you modify that file with new Environment variables or new values, you will have to restart Connect service)
Last modified 1yr ago