Opened 6 years ago

Closed 6 years ago

#9182 closed (wontfix)

Here's an rc.d script for FastCGI on BSD

Reported by: kriskowal Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

For: http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#lighttpd-setup

This script implements all the usual daemon control operations like "start", and "stop", and also starts "fastcgi" on boot before "lighttpd".

</usr/local/etc/rc.d/mond.sh>

#!/bin/sh

# PROVIDE: fastcgi
# BEFORE: lighttpd
# REQUIRE: DAEMON

. /etc/rc.subr
name="fastcgi"
rcvar=`set_rcvar`

load_rc_config $name

: ${fastcgi_enable="NO"}

command=python
host=localhost
port=3033
pidfile=/var/run/fastcgi.pid
sig_stop="-INT"
sig_reload="-INT"
start_cmd=start_cmd
stop_postcmd=stop_postcmd
reload_precmd=reload_precmd
reload_postcmd=reload_postcmd

start_cmd()
{
    DJANGO_SETTINGS_MODULE=.............settings \
    .............../django/bin/django-admin.py runfcgi \
        host=${host} \
        port=${port} \
        pidfile=${pidfile}
}

stop_postcmd()
{
    rm -f ${pidfile}
}

reload_precmd()
{
    echo "Stoping ${name} and start gracefully."
}

reload_postcmd()
{
    rm -f ${pidfile}
    run_rc_command start
}

run_rc_command "$1"

Change History (2)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

This isn't really specific for the documentation. It's highly specific to BSD, won't even work on Linux systems (things like load_rc_config and run_rc_command are specific). There may be a small argument for including scripts like this in a scripts directory somewhere, but even that's going to open the door for an init script for every possible distribution (since there are a lot of variations by the time we take into account the BSD variations, OpenSolaris, even just the major Linux distros and Macs).

Alternatively, it might be worthwhile to include in something in the docs/howto/ directory for distribution-specific stuff (it would need more clarification about which BSD-variant this is targeted for, since there are variations even in that small space and I'm not if they apply here).

comment:2 Changed 6 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from new to closed

After thinking about this some more, given all the variations between systems, it will be a bit of a fool's errand for us to try and keep up-to-date scripts for every distribution that might run Django.

So, thanks for the script, but there's nothing we can really do with it. You could either submit it to the appropriate *BSD packager(s) for their use or make a wiki page for it and give it a descriptive title so that people find it when Googling if they need such a thing.

Note: See TracTickets for help on using tickets.
Back to Top