supervisor program:x command expansion of environment variables $(ENV_VAR)s?
supervisord
Solution
I agree supervisor is not clear about this ( to me at least ).
I've found the easiest solution to execute /bin/bash -c. In your case it would be:
command=/bin/bash -c"/path/to/myprog/myservice /data/myprog/${SITE}/${SITE}.db ..."
What do you think?
I've found inspiration here: http://blog.trifork.com/2014/03/11/using-supervisor-with-docker-to-manage-processes-supporting-image-inheritance/
Problem
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): ``` [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 command: "String expressions are evaluated against a dictionary containing the keys group_name, host_node_name, process_num, program_name, here (the directory of the supervisord config file), and all supervisord's environment variables prefixed with ENV_." Introduced: 3.0 Related: There are open pull requests to enable expansion in additional section values: https://github.com/Supervisor/supervisor/issues?labels=expansions&page=1&state=open A search of goole (or SO) returns no examples of attempts to use %(ENV_VAR)s expansion in the command section value: https://www.google.com/search?q=supervisord+environment+expansion+in+command