Skip to content

Instantly share code, notes, and snippets.

@fdelbos
Created September 17, 2011 00:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdelbos/1223429 to your computer and use it in GitHub Desktop.
Save fdelbos/1223429 to your computer and use it in GitHub Desktop.
A FreeBSD startup script for starting Gunicorn workers
#!/bin/sh
#
# PROVIDE: gunicornd
#
# Filename: gunicornd
# Author: Frederic DELBOS - fred.delbos@gmail.com
# Created: Sat Sep 17 00:29:58 2011 (+0200)
# Last-Updated: Sat Sep 17 02:04:02 2011 (+0200)
# By: Frederic DELBOS - fred.delbos@gmail.com
# Update #: 15
#
#
. /etc/rc.subr
name="gunicornd"
rcvar=`set_rcvar`
start_cmd="${name}_start"
stop_cmd=":"
load_rc_config $name
gunicornd_start()
{
export PYTHON_EGG_CACHE=/tmp
if checkyesno ${rcvar}; then
cd /home/django/www/mydjangoapp;
/usr/local/bin/gunicorn_django --workers=2 --bind=127.0.0.1:8000 --max-request=1024 --user=django;
fi
}
load_rc_config $name
run_rc_command "$1"
@odhiambo
Copy link

Thank you very much. This saved my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment