Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can't seem to figure out how to append to the default path in a supervisord program config.

I can reset the path:

environment=PATH="/home/site/environments/master/bin"

But when I try:

environment=PATH="/home/site/environments/master/bin:$PATH"

I see that supervisord doesn't evaluate $PATH.

Google wasn't a big help on this for some reason, I cannot believe I'm the first person to need this.

Supervisord must have support for this, any idea what it is?

share|improve this question
    
have you found a solution for this problem? I just have the same issue –  ascobol Jan 16 '12 at 16:07
1  
@ascobol nope, I've hardcoded the path I need, for now –  Prody Jan 17 '12 at 10:36
2  
supervisord don't run shell to preprocess variables in the config file, so you can't use shell expressions to expand variables. Although there is a patch that allows to do %($PATH) and it was discussed in mailing lists back in 2011 but AFAIK it is still not included to the mainline source tree. As a workaround you can create a script that will setup environment and execute a command supplied in arguments. Then you just run the script from the supervisord like command /usr/local/bin/setup_env_master.sh program_name arguments –  Dmitry Vasilyanov Dec 2 '12 at 17:49
    
There is a significant drawback to the shell wrapper solution - when supervisor will try to stop the process using INT or KILL, the signal will be received by the bash script and not the actual wrapped program. This may lead (and leads in my case) to dangling processes. –  stoiczek Apr 15 at 19:34
    
@stoiczek easy problem to solve. Use exec at the end of the bash script, do not just run the command regularly. So exec server --args. You see it in upstart jobs invariably. –  CameronNemo Jul 1 at 17:27
add comment

2 Answers 2

up vote 2 down vote accepted

I reviewed the documentation and agree with Dmitry.

The current answer is: supervisor doesn't do this directory, but creating a wrapper script will help.

share|improve this answer
add comment

This feature has been added to Supervisor recently

environment=PATH="/home/site/environments/master/bin:%(ENV_PATH)s"

https://github.com/Supervisor/supervisor/blob/master/supervisor/skel/sample.conf#L8

See also https://stackoverflow.com/questions/12900402/supervisor-and-environment-variables

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.