#!/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"