My app is a jar file that requires some environment variables. I have all the environment variables in one file, which looks like this:
export VAR=value
export VAR2=value2
#....etc
My supervisor config file looks like this:
[program:programname]
command=bash -c "source /path/to/env/file && java -jar /path/to/jar.jar"
ps -ef | grep programname
shows two processes on two separate lines: one is bash -c "source blah && java blah"
and the other one is just java blah
.
Now, here's the problem: whether I do supervisorctl stop programname
or service supervisor stop
or even kill -9 whatever the supervisor pid is
, the first process dies, but the regular java process stays and becomes orphaned, with parent pid now 1. How do I make the jar die without manually killing it?
killasgroup=true
. (andstopasgroup=true
if you wish).