FREEBSDPYTHONFCGIInitScript


 * 1) !/bin/sh
 * 2) Script wrote by Jose Amengual
 * 3) PROVIDE: python fcgi start up script

. /etc/rc.subr

name="python_fcgi" rcvar=${name}_enable

project_path="/path_to_your_python_project/code/foo" pidfile=/var/run/python-fcgi.pid

load_rc_config ${name}

[ -z "$python_fcgi_enable" ]     && python_fcgi_enable="NO"
 * 1) add python_fcgi_enable="YES" to rc.conf

command=/usr/local/bin/python command_args="${project_path}/manage.py runfcgi maxchildren=10 maxspare=5 minspare=2 \ method=prefork socket=/tmp/python_fcgi.sock pidfile=${pidfile} --pythonpath=${project_path}"
 * 1) change maxchildren, maxspare, minspare to whatever you need

deqq_client_stop { echo "Stopping $name." pids=`cat /var/run/python_fcgi.pid` kill ${pids} wait_for_pids $pids }

run_rc_command "$1" chown www:www /tmp/python_fcgi.sock
 * 1) changing permission the the socket so nginx can talk to it