简体   繁体   中英

Accessing environment variables in Linux service conf files

I have a bunch of environment variables in /etc/environment in a Debian OS. I would like to use some of these environment variables in various configuration files, for example, /etc/service/service.conf . Typically I can use the variables, defined in /etc/environment like below.

/etc/environment :

MYVAR="Some value"

script.sh :

echo ${MYVAR}

Typically I can use export MYVAR="Some value" which the Apache configuration files can pick up, but other services such as dhcp (/etc/dhcp/dhcpd.conf) do not.

What are my options in this case?

/etc/environment is not system-wide configuration file. just use systemd-system.conf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM