Skip to content

Instantly share code, notes, and snippets.

@marshyski
Last active May 22, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshyski/ec99c36529f58482b140383eefa0a49d to your computer and use it in GitHub Desktop.
Save marshyski/ec99c36529f58482b140383eefa0a49d to your computer and use it in GitHub Desktop.
#!/bin/bash
NAME=project
WORKERS=`lscpu | grep ^'CPU(s)' | awk '{ print $2 }'`
DEPLOY_DIR=./
if [[ `grep ^nginx /etc/passwd` = "" ]]; then
if [[ `grep ^www-data /etc/passwd` = "" ]]; then
GUN_USER=$USER
fi
fi
if [[ `grep ^nginx /etc/passwd` != "" ]]; then
GUN_USER=nginx
fi
if [[ `grep ^www-data /etc/passwd` != "" ]]; then
GUN_USER=www-data
fi
if [[ $1 = "" ]]; then
LISTEN_ADDR=127.0.0.1
else
LISTEN_ADDR=0.0.0.0
fi
pwd
gunicorn $NAME:app -b $LISTEN_ADDR:8080 \
--name $NAME \
--workers $WORKERS \
--user $GUN_USER \
--log-level debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment