On 30.11.2014 13:27, Gustavo Carneiro wrote:
On 30 November 2014 at 12:17, Ingo Fischer <[email protected] <mailto:[email protected]>> wrote:Hi all! I'm running a Gunicorn server inside a schroot <https://wiki.debian.org/Schroot> session via supervisor. My problem is that the service is not fully stopped when stopping it with "supervisorctl stop". This is the script (simplified) controlling my server, it opens a schroot session and runs gunicorn in it, in foreground: #/bin/sh # gunicorn.sh schroot -c gunicorn -r -- bash -c "gunicorn --workers=1 myapp.wsgi:application" Maybe it helps to put exec in front of gunicorn?
I'm pretty sure I tried using exec in various combinations with no success before... Now I tried again and suddenly it works, all gunicorn child processes are gone when I call the stop-command.
Indeed using exec seems to be the solution to the problem. Thank you, Gustavo!
schroot -c gunicorn -r -- bash -c "exec gunicorn --workers=1 myapp.wsgi:application"This is my supervisor config to run this script: # gunicorn.conf [program:gunicorn] command=/home/test/gunicorn.sh stderr_logfile=/var/log/gunicorn.err.log stdout_logfile=/var/log/gunicorn.out.log When I start the service via "supervisorctl start" , my process tree looks like this: init(1)-supervisord(7175)---gunicorn.sh(8061)---schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078) Now when I stop the service with "supervisorctl stop", The corresponding supervisor process and its direct child, gunicorn.sh, are terminated. But the schroot process itself continues to live and is now a child of the init process: init(1)-schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078) This whole behavior might be related to the way schroot works. But what I do not understand is that Supervisor config says that as long as a process runs in foreground and stays attached to the console, supervisor should be able to start/stop it. And I believe that this is how my schroot-process behaves. But still supervisor seems unable to stop the process. What can I do to stop the gunicorn process correctly with supervisorctl stop? Thanks in advance! Cheers, Ingo _______________________________________________ Supervisor-users mailing list [email protected] <mailto:[email protected]> https://lists.supervisord.org/mailman/listinfo/supervisor-users -- Gustavo J. A. M. Carneiro Gambit Research "The universe is always one step beyond logic." -- Frank Herbert
_______________________________________________ Supervisor-users mailing list [email protected] https://lists.supervisord.org/mailman/listinfo/supervisor-users
