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. Django Settings Assignment Expressions aka Walrus Operator example by webology 3 weeks, 1 day ago
  2. codigo alto nivel by MrRocklion 2 months, 2 weeks ago
  3. Load template from specific app by Krzysiek555 3 months, 1 week ago
  4. PostgreSQL JSON subqueries by dolamroth 3 months, 1 week ago
  5. "Magic Link" Management Command by webology 8 months, 2 weeks ago

Comments

Please login first before commenting.