over 8 years ago

I wrote two simple scripts for starting and stopping a gunicorn server that hosts a Django project.

Create a run.sh:


source `which virtualenvwrapper.sh`  #assuming you use virtualenv

workon your_env_name # if you do not use virtualenv, remove this line the line above

gunicorn -c gunicorn.conf.py your_project_name.wsgi --daemon 

Create a stop.sh:


kill -9 `ps aux |grep gunicorn |grep your_app_name | awk '{ print $2 }'`  # will kill all of the workers

Once these scripts are created, don't forget to set the permission:

chmod 755 run.sh
chmod 755 stop.sh

To run them:

← Bootstrap's Accordion 在Linux下设置重复执行的工作 →
comments powered by Disqus