Adrenalin’s Experience

FreeBsd tracd “rc.d” script

Posted in freebsd by Adrenalin on March 23, 2008

If you want to run trac as a standalone server for startup you’ll need a /usr/local/etc/rc.d script, by default it is missing.

First google search gave me this http://freebsd.amazingdev.com/blog/archives/000798.html

I have slightly modified this script to play better with pids:

#!/bin/sh
#
# tracd.sh for rc.d usage (c) 2006 Jonathan Arnold, 2008
# $Id$

# PROVIDE: tracd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable Tracd:
#
# tracd_enable=”YES”
# # optional
# tracd_flags=”-d –listen-port=3690″
# tracd_data=”/usr/local/path/to/project”

. “/etc/rc.subr”

# Set some defaults
tracd_enable=${tracd_enable:-“NO”}
tracd_flags=${tracd_flags:-“-d –port=8080 “}
tracd_data=${tracd_data:-“/usr/local/trac”}
tracd_pidfile=${tracd_pidfile-“/var/run/tracd.pid”}

name=”tracd”
rcvar=`set_rcvar`
load_rc_config $name

command=/usr/local/bin/tracd
command_args=” –pidfile=${tracd_pidfile} ${tracd_data}”
command_interpreter=”/usr/local/bin/python”
pidfile=”${tracd_pidfile}”

run_rc_command “$1”

And your vars in /etc/rc.conf should look smth. like:

tracd_enable=”YES”
tracd_data=”/usr/local/trac/project/”
tracd_flags=”-dsp 8080 –auth=project,/usr/local/trac/project/conf/users.htdigest, ProjectRealm”

Tagged with: , ,

3 Responses

Subscribe to comments with RSS.

  1. Vitaly said, on October 31, 2008 at 3:42 pm

    Character conversions on your page made it difficult to use. I had to replace all the quotation marks with usual ones and em-dash to “–” manually. You’d better posted it pre-formatted.

    Also, it took some time to notice that trac_data should have “-e ” prefix for multi-project Trac configuration.

  2. Adrenalin said, on October 31, 2008 at 4:03 pm

    Thanks for bringing this up, hopefully it’s fixed now.. (dumb wp)

  3. Scott Willson said, on November 26, 2008 at 1:06 am

    Thanks! Just what I needed.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: