3

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?

Luiza Rodrigues
  • 185
  • 1
  • 2
  • 15

2 Answers2

4

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!

Luiza Rodrigues
  • 185
  • 1
  • 2
  • 15
0

Probably nohup will help

nohup your command

What's the difference between nohup and ampersand

Also check the --daemon option, it could be similiar to forewer, for details and other suggestions see

What is the correct way to leave gunicorn running?

Serge
  • 3,387
  • 3
  • 16
  • 34