0

I have a bunch of job/daemon configuration files, say:

/etc/init/service1.conf
/etc/init/service2.conf
/etc/init/service3.conf

Most of those jobs are quite similar, and the files are of a format like:

description "Some service"

...
env NAME1=VALUE1
env NAME2=VALUE2
env NAME3=VALUE3
...

exec something

The env variable section is the same across all files. Is there an easy way to avoid having to repeat the variables in all the files, while also not setting them system-wide (they should only be visible to the jobs)? Something like a #include "env_config.txt" that I can replace the env section in the configs with?

houbysoft
  • 305
  • 2
  • 8

1 Answers1

0

I think you can use set -a to export all the varibles followed by sourcing . the file

set -a 
. /path/to/envvars
user9517
  • 115,471
  • 20
  • 215
  • 297