What is the good way to set environment variable in supervisord using output from a file? I need like:

command=prog1 -param1 -param2
environment=PASSWORD=`cat .password`

I can use an additional script, but perhaps the better way exists:



export PASSWORD=`cat .password`

Environment variables that are present in the environment at the time that supervisord is started can be used in the configuration file using the Python string expression syntax %(ENV_X)s:


You can use (in Bash)

export PASSWORD1=$(cat .password)

Then use this in the configuration file

environment = PASSWORD=%(PASSWORD1)s
  • I need to use different environment variables for each process, because some process can be started on a host and each process should have own password, that is impossible if I'll use one scrip for exporting variable and supervizord for starting processes. – Dimaf Dec 12 '16 at 20:17
  • 1
    This does not work in Supervisor 3.2. – Newb Mar 27 '17 at 22:29
  • @Newb do you know how to fix it in 3.2? – Kolyunya May 29 '17 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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