Last active
May 22, 2016 17:24
-
-
Save marshyski/ec99c36529f58482b140383eefa0a49d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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