Passing environment variables from pre-start (or the shell) to exec

Alexandros Kostopoulos akostop at inaccessnetworks.com
Thu May 31 12:02:20 BST 2007


Dear all,
I am working on porting an embeddded environment from sysvinit to upstart.  
I have several issues, but I'm trying to work them out as best as  
possible. One of these is the following: I want to be able to pass  
environment variables from the shell (or at least from the pre-start  
script) to the exec stanza. For example, I want to run httpd, which takes  
several options, like -p <port>. These settings are stored in a file, e.g,  
/etc/default/httpd. I must source this file in pre-start to get the  
environment variables and then use exec httpd -p $PORT. However, upstart  
seems to ignore all env variables set in pre-start when it runs something  
in exec stanza. So my question boils down to this: is there any way to  
pass environment variables to exec stanza (and I am not talking about the  
event environment variables, since I want this to work even when I start  
the job manually).

Thank you in advance

Alex



More information about the upstart-devel mailing list