Skip to content

Instantly share code, notes, and snippets.

@ryanpadilha
Created January 4, 2019 13:25
Show Gist options
  • Save ryanpadilha/3c2e5472779e08c7426c2cc1b92c5cb5 to your computer and use it in GitHub Desktop.
Save ryanpadilha/3c2e5472779e08c7426c2cc1b92c5cb5 to your computer and use it in GitHub Desktop.
This script start python application using Gunicorn
#!/bin/bash
# This script start python application using Gunicorn
set -e # if occur any error, exit
function to_console {
echo -e "\n*** $1 ***\n"
}
cd $(dirname $0) && cd .. && cd .. && cd ..
to_console "activate virtual environment sandbox"
source venv-sandbox/bin/activate
PID=/var/named/run/gunicorn-demo-alclaudius.pid
if [ -f $PID ]; then rm $PID; fi
to_console "start python application"
exec gunicorn -w 3 --bind=0.0.0.0:9001 --user=ubuntu --log-level=debug --pid=$PID --log-file=/var/named/logs/demo.alclaudius.com.br/gunicorn.log 2>>/var/named/logs/demo.alclaudius.com.br/gunicorn.log 'wsgi:application(mode="demo")' &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment