= Django FastCGI init.d script for Gentoo Linux = If you're not using Gentoo Linux and for more information about FastCGI/init.d go back to [wiki:InitdScriptForLinux Django FastCGI init.d script for Linux] == The initialisation script == This version uses TCP connections. I'm working on a socket-version too. {{{ #!/sbin/runscript DJANGO_SITES="stdout stuffit" SITES_PATH=/var/django/sites RUNFILES_PATH=/var/django/run HOST=127.0.0.1 PORT_START=3000 start() { ebegin "Starting django-fgci" PORT=$PORT_START for SITE in $DJANGO_SITES do VERBOSE_NAME="$SITE $HOST:$PORT" if [ -f $RUNFILES_PATH/$SITE.pid ]; then ewarn "$VERBOSE_NAME already running ($RUNFILES_PATH/$SITE.pid)" else start-stop-daemon --start \ --pidfile $RUNFILES_PATH/$SITE.pid \ --exec /usr/bin/env -- python \ $SITES_PATH/$SITE/manage.py runfcgi \ method=threaded \ host=$HOST port=$PORT pidfile=$RUNFILES_PATH/$SITE.pid chmod 400 $RUNFILES_PATH/$SITE.pid einfo "$VERBOSE_NAME started" fi let "PORT = $PORT + 1" done eend $? } stop() { ebegin "Stopping django-fgci" for SITE in $DJANGO_SITES do VERBOSE_NAME="$SITE" start-stop-daemon --stop \ --pidfile $RUNFILES_PATH/$SITE.pid \ && einfo "$VERBOSE_NAME stopped" \ || ewarn "$VERBOSE_NAME not running" if [ -f $RUNFILES_PATH/$SITE.pid ]; then rm $RUNFILES_PATH/$SITE.pid fi done eend $? } }}}