Supervisor: Bash environment variables not identified in supervisord.conf

Created on 17 Jan 2018  路  2Comments  路  Source: Supervisor/supervisor

I have an issue when using environment variable defined in .bash_profile. When I run this command :
sudo supervisord -c /etc/supervisord.conf.
It always return :
format string '%(ENV_nnsm3_name)s' for 'program:laravel-process-user-data-queue.user' contains names ('ENV_nnsm3_name') which cannot be expanded. .

1. supervisord.conf file:

[unix_http_server]
file=/tmp/supervisor.sock   ; the path to the socket file

[supervisord]
enviroment=nnsm3_root3=%(ENV_nnsms3_root)s,nnsm3_name=%(ENV_nnsm3_name$)
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB        ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10           ; # of main logfile backups; 0 means none, default 10
loglevel=info                ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false               ; start in foreground if true; default false
minfds=1024                  ; min. avail startup file descriptors; default 1024
minprocs=200                 ; min. avail process descriptors;default 200

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:laravel-process-user-data-queue]
process_name=%(program_name)s_%(process_num)02d
command=sudo php %(ENV_nnsm3_root)s/app/artisan queue:listen --tries=3  --queue=high,default,low
autostart=true
autorestart=true
user=%(ENV_nnsm3_name)s
numprocs=1
redirect_stderr=true
stderr_logfile=%(ENV_nnsm3_root)s/app/storage/logs/supervisor/processuserdata.err.log
stdout_logfile=%(ENV_nnsm3_root)s/app/storage/logs/supervisor/processuserdata.out.log

2. .Bash_profile :

source ~/.profile
 export PATH=/Applications/MAMP/bin/php/php7.0.19/bin:$PATH
export PATH="/usr/local/sbin:$PATH"
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export nnsm3_root="/Users/JasemAl-sadi/Desktop/SMS/Local websites/nnsm3_main"
export nnsm3_user="Sony"                  

I am running in macOS High Sierra with Mamp pro with PHP 7.1 with supervisor 3.3.3

I saw most of the related issues, but nothing work

environment question

Most helpful comment

No shell is run when supervisord changes to a user. Since no shell is run, features like .bash_profile are not available. supervisord calls setuid() only. See Subprocess Environment for more information.

All 2 comments

@mnaberez any help :)

No shell is run when supervisord changes to a user. Since no shell is run, features like .bash_profile are not available. supervisord calls setuid() only. See Subprocess Environment for more information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flaugher picture flaugher  路  30Comments

ramary picture ramary  路  33Comments

lra picture lra  路  60Comments

mkotsalainen picture mkotsalainen  路  28Comments

guettli picture guettli  路  96Comments