Discussion:
[Supervisor-users] environment variables
Marcos Cano
2013-09-30 21:59:36 UTC
Permalink
hello im trying to achieve something like this..

command=java -server -Xmx128M -classpath $DIRECT some.java.Application


where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...

but when trying to run it... it can not start because the classpath is not
set unless i explicitly set it like


command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application


is there any way i can achieve this? or am i doing something wrong?

greetings
Brent Tubbs
2013-09-30 23:08:44 UTC
Permalink
IIRC, 'command' isn't executed in a shell context, and can't itself use
environment variables passed in by Supervisor. You could put your command
in a Bash script though, have Supervisor call that, and there you should be
able to use $DIRECT.
Post by Marcos Cano
hello im trying to achieve something like this..
command=java -server -Xmx128M -classpath $DIRECT some.java.Application
where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...
but when trying to run it... it can not start because the classpath is not
set unless i explicitly set it like
command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application
is there any way i can achieve this? or am i doing something wrong?
greetings
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Marcos Cano
2013-09-30 23:18:27 UTC
Permalink
the problem is that if i put my command in a script it will create (lets
suppose) pid of 2448 i will then loose control of the command itself,
because when i check it with ps aux , my command will be with a PID of 2450

i dont know if that make sense?
Post by Brent Tubbs
IIRC, 'command' isn't executed in a shell context, and can't itself use
environment variables passed in by Supervisor. You could put your command
in a Bash script though, have Supervisor call that, and there you should be
able to use $DIRECT.
Post by Marcos Cano
hello im trying to achieve something like this..
command=java -server -Xmx128M -classpath $DIRECT some.java.Application
where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...
but when trying to run it... it can not start because the classpath is
not set unless i explicitly set it like
command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application
is there any way i can achieve this? or am i doing something wrong?
greetings
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Marcos Cano
2013-09-30 23:25:59 UTC
Permalink
scipt will have different PID from the command within the script.. so with
supervisor i will just have control over the script, not the script that is
inside the script...

i think that made more sense...
Post by Marcos Cano
the problem is that if i put my command in a script it will create (lets
suppose) pid of 2448 i will then loose control of the command itself,
because when i check it with ps aux , my command will be with a PID of 2450
i dont know if that make sense?
Post by Brent Tubbs
IIRC, 'command' isn't executed in a shell context, and can't itself use
environment variables passed in by Supervisor. You could put your command
in a Bash script though, have Supervisor call that, and there you should be
able to use $DIRECT.
Post by Marcos Cano
hello im trying to achieve something like this..
command=java -server -Xmx128M -classpath $DIRECT some.java.Application
where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...
but when trying to run it... it can not start because the classpath is
not set unless i explicitly set it like
command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application
is there any way i can achieve this? or am i doing something wrong?
greetings
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Brent Tubbs
2013-09-30 23:32:19 UTC
Permalink
Use "exec <put command here>" in your script, and the command itself will
replace the bash process.
Post by Marcos Cano
scipt will have different PID from the command within the script.. so with
supervisor i will just have control over the script, not the script that is
inside the script...
i think that made more sense...
Post by Marcos Cano
the problem is that if i put my command in a script it will create (lets
suppose) pid of 2448 i will then loose control of the command itself,
because when i check it with ps aux , my command will be with a PID of 2450
i dont know if that make sense?
Post by Brent Tubbs
IIRC, 'command' isn't executed in a shell context, and can't itself use
environment variables passed in by Supervisor. You could put your command
in a Bash script though, have Supervisor call that, and there you should be
able to use $DIRECT.
Post by Marcos Cano
hello im trying to achieve something like this..
command=java -server -Xmx128M -classpath $DIRECT some.java.Application
where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...
but when trying to run it... it can not start because the classpath is
not set unless i explicitly set it like
command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application
is there any way i can achieve this? or am i doing something wrong?
greetings
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
David Birdsong
2013-09-30 23:31:17 UTC
Permalink
Post by Marcos Cano
hello im trying to achieve something like this..
command=java -server -Xmx128M -classpath $DIRECT some.java.Application
where the environment variable DIRECT, could be inherit from the
supervisord config file environment option or by the sub-process itself
environment option...
but when trying to run it... it can not start because the classpath is not
set unless i explicitly set it like
command=java -server -Xmx128M -classpath /path/that/iwant/
some.java.Application
is there any way i can achieve this? or am i doing something wrong?
Rather than going through the trouble of passing an environment value down
from the master supervisor config, what is so unsatisfying about putting
the value in the command argument explicitly?

Inheriting and then trying to go through contortions to get either a shell
or supervisor to expand the variable that you've gone through the trouble
of putting into the main supervisor config sounds troublesome and confusing
to me.
Post by Marcos Cano
greetings
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Loading...