"source" a file

Asked by Jeff Oliver on 2008-10-21

I thought a some point i read about upstart having or going to have support for somehow dealing with the config files that could be dropped in /etc. For instance, if I have a file /etc/sysconfig/dhcpd, I'd like the job file to "source" it so that the environment contains the variables defined in /etc/sysconfig/dhcpd.

Can you do this with upstart 0.5.0?

Question information

Language:
English Edit question
Status:
Solved
For:
upstart Edit question
Assignee:
No assignee Edit question
Solved by:
Jeff Oliver
Solved:
2008-11-13
Last query:
2008-11-13
Last reply:
2008-10-24

On Tue, 2008-10-21 at 21:09 +0000, Jeff Oliver wrote:

> I thought a some point i read about upstart having or going to have
> support for somehow dealing with the config files that could be
> dropped in /etc. For instance, if I have a file /etc/sysconfig/dhcpd,
> I'd like the job file to "source" it so that the environment contains
> the variables defined in /etc/sysconfig/dhcpd.
>
> Can you do this with upstart 0.5.0?
>
No, but it's a valid request

Scott
--
Scott James Remnant
<email address hidden>

Jeff Oliver (jeffrey-oliver) said : #2

I added a source stanza to the job file that will read a file that contains KEY=VALUE pairs. At the moment it's pretty brain-dead. It skips whitespace and comments (#), but does not deal well with possible "other" things, such as shell script function declarations.

Silvano Galliani (kysucix) said : #3

As for now I source the configuration file inside every start-script / end-script block in a plain shell syntax:
. /etc/configuration

It's a nice workaround.