Discussion:
[Supervisor-users] Does program:x command support expansion of ENV_ environment variables?
Jeff Kowalczyk
2013-12-04 21:29:42 UTC
Permalink
I would like to put configuration (in this case, site name) into
supervisor environment variables, for expansion in program:x command
arguments. Is this supported? The documentation's wording would seem
to indicate yes.

The following syntax is not working for me on supervisor-3.0 (excerpt
of config file, lines wrapped):

[supervisord]
environment = SITE="mysite"

[program:service_name]
command=/path/to/myprog/myservice /data/myprog/%(ENV_SITE)s/%(ENV_SITE)s.db
%(program_name)s_%(process_num)03d
process_name=%(program_name)s_%(process_num)03d
numprocs=5
numprocs_start=1

Raises the following error:

sudo supervisord -c supervisord.conf

Error: Format string
'/path/to/myprog/myservice /data/myprog/%(ENV_SITE)s/%(ENV_SITE)s.db
%(program_name)s_%(process_num)03d
for 'command' contains names which cannot be expanded

Reading the documentation, I expected environment variables to be
available for expansion in program:x command as %(ENV_VAR)s:

http://supervisord.org/configuration.html#program-x-section-values

Thanks for any clarification you can provide.

Jeff

Note: asked previously on StackOverflow:

http://stackoverflow.com/questions/20324589/supervisor-programx-command-
expansion-of-environment-variables-env-vars

Loading...