Skip to content

Instantly share code, notes, and snippets.

@shiloa
Created September 12, 2012 05:12
Show Gist options
  • Save shiloa/3704416 to your computer and use it in GitHub Desktop.
Save shiloa/3704416 to your computer and use it in GitHub Desktop.
#!/bin/sh
# ******
# This goes in /etc/init.d
# ******
# start nginx
/usr/local/bin/nginx/
sleep 10
# start the app
/srv/my_application/script/start
exit 0
#!/bin/sh
APP_ROOT=/srv/my_application
echo "stopping the app..."
bash $APP_ROOT/scripts/stop
sleep 5
echo "starting the app..."
bash $APP_ROOT/scripts/start
#!/bin/sh
APP_ROOT=/srv/my_application
cd $APP_ROOT
# start a couple of instances
# note that the worker timeout is set to 300s due to an app requirement
gunicorn -w 4 -b 127.0.0.1:8000 -t 300 -D --access-logfile=$APP_ROOT/log/access.8000.log --error-logfile=$APP_ROOT/log/error.8000.log my_app:app
gunicorn -w 4 -b 127.0.0.1:8001 -t 300 -D --access-logfile=$APP_ROOT/log/access.8001.log --error-logfile=$APP_ROOT/log/error.8001.log my_app:app
#!/bin/sh
# nothing fancy here
pkill gunicorn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment