Login

FreeBSD rc.d FastCGI Script

Author:
davidblewett
Posted:
September 12, 2008
Language:
Python
Version:
1.0
Score:
2 (after 2 ratings)

This is a simple rc script, suitable for starting a FastCGI daemon on FreeBSD. Simply copy this into /usr/local/etc/rc.d , change all references to "signet" to the name of your app, mark it executable and modify /etc/rc.conf accordingly.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
# signet.sh for rc.d usage (c) 2008 David Blewett.
# $Id$

# PROVIDE: signet
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable signet:
#
#  signet_enable="YES"
#  # optional
#  signet_flags="maxchildren=5 minspare=1 maxspare=2 socket=/tmp/signet-fcgi.sock"
#  signet_data="/usr/local/www/signet"
. "/etc/rc.subr"

# Set some defaults
signet_enable=${signet_enable:-"NO"}
signet_flags=${signet_flags:-"maxchildren=5 minspare=1 maxspare=2 socket=/tmp/signet-fcgi.sock"}
signet_data=${signet_data:-"/usr/local/www/signet"}
signet_user=${signet_user:-"svn"}

name=signet
rcvar=`set_rcvar`
load_rc_config $name
pidfile="/var/run/${name}.pid"
command=/usr/local/www/signet/manage.py
command_interpreter="python"
command_args="runfcgi workdir=$signet_data pidfile=$pidfile daemonize=true"

start_cmd="echo \"Starting ${name}.\"; su ${signet_user} -c \"${command} ${command_args} ${signet_flags}\""

run_rc_command "$1"

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 11 months, 2 weeks ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 11 months, 3 weeks ago
  3. Serializer factory with Django Rest Framework by julio 1 year, 6 months ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 7 months ago
  5. Help text hyperlinks by sa2812 1 year, 7 months ago

Comments

Please login first before commenting.