"source" a file

Asked by Jeff Oliver

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:
Last query:
Last reply:
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) said :
#1

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>

Revision history for this message
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.

Revision history for this message
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.