简体   繁体   中英

Supervisord configured Environment variable in Java process

My java process takes a env variable "config". It works when I shoot the process from command line with "java -Dconfig=... ..."

Now I have configured Supervisord and added the programs. I also have added the below entry under supervisor tag in conf file

environment=KEY="value",config="my path"

I think this value should be propagated to all child processes, hence my child java process should be able to access it with System.getProperty(). But it is not getting any env variable with name "config".

Any help :)

The environment configuration parameter of Supervisord is for operating system (Linux) environment variables. Parameters passed using -D , on the other hand, are JVM options. The correct way is to pass JVM options in command .

command=java -Dconfig=... 

Don't forget quotes if a command argument contains spaces. See http://supervisord.org/configuration.html#program-x-section-values

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM