Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gunicorn and python doesn't work when i close the bash terminal

I have a python program running on a centos machine. I used virtualenv (source activate) to activate a specific python and then I use the following command:

gunicorn -t 10000 -b 0.0.0.0:1234 start:app &

It works fine. But when i close the bash, my program doens't work anymore. when i open a new bash (through PUTTY), and type

 ps -C gunicorn

i see the gunicorn process running. If i put all this on local.rc (to initialize together with the server) everything works fine always.

I have two questions. First one is:

Can i put a "forever" on gunicorn (like we put on node.js), or dettach gunicorn and virtualenv from the bash, in order to always run independent of closing the bash?

How can i solve this problem?

like image 284
Luiza Rodrigues Avatar asked Oct 23 '25 17:10

Luiza Rodrigues


1 Answers

I found the answer. I tried to use nohup, with no success. Now i am using

gunicorn -t 10000 -b 0.0.0.0:1234 start:app  --daemon &

The --daemon option worked for me!

like image 123
Luiza Rodrigues Avatar answered Oct 25 '25 08:10

Luiza Rodrigues



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!