Working on FreeBSD

0 views
Skip to first unread message

Gary Doades

unread,
Apr 15, 2008, 9:41:37 AM4/15/08
to SwitchPipe
If anyone is interested I have managed to get switchpipe (1.04)
working on FreeBSD 6.2/7.0

During setup the only thing that doesn't work according to the
instructions is the automatic installation of the required gems
because FreeBSD doesn't have a sudo command by default. You can either
intall sudo from ports or just install the gems manually first. The
latter seems easier!

Other than that it all works perfectly.

I've also generated a simple startup script to start switchpipe at
boot as a replacement for the supplied initdscript. Just drop this
into /usr/local/etc/rc.d and make it executable.

------------ script start ---------------------------

#!/bin/sh
#
# switchpipe: Backend Web application controller and proxy
#
# chkconfig: 345 96 99
# description: http://switchpipe.org/
# switchpipe for rc.d usage
# $Id$

# PROVIDE: switchpipe
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#

. /etc/rc.subr

name="switchpipe"
SWITCHPIPE_PATH="/usr/local/switchpipe"
SWITCHPIPE_RUNNER="$SWITCHPIPE_PATH/script/switchpipe"
PATH=$PATH:/usr/local/bin:/opt/local/bin
start_cmd="start"
stop_cmd="stop"
extra_commands="restart"

# Sanity checks.
[ -x $SWITCHPIPE_RUNNER ] || exit 0

start() {
echo "Starting switchpipe daemon.."
$SWITCHPIPE_RUNNER start
}

stop() {
echo "Stopping switchpipe daemon.."
$SWITCHPIPE_RUNNER stop
sleep 2
}

load_rc_config $name
run_rc_command "$1"

------------ script end ---------------------

Cheers,
Gary.

Peter Cooper

unread,
Apr 16, 2008, 6:08:42 PM4/16/08
to SwitchPipe
Excellent work, and thanks for the information! I'm going away for two
days tomorrow but will get this sorted out at the weekend. I'm also in
the middle of migrating SwitchPipe to Github so that contributions
will become a lot easier :)

Pete

Peter Cooper

unread,
Apr 20, 2008, 2:19:41 PM4/20/08
to SwitchPipe
Just a question..

Am I going to need to have an init script for BSD and one for Linux?
Or are the additions you've made pretty generic in terms of rc.d init
scripts?

Pete

Gary Doades

unread,
Apr 23, 2008, 3:29:56 PM4/23/08
to SwitchPipe
This is a FreeBSD specific init script I'm afraid. Linux works in
quite a different way to the rc.d system of FreeBSD. At least that's
as I understand it.

As shell scripting is pretty generic, it may be possible to turn one
or the other into a generic script by testing which platform it is
running on and only executing the appropriate parts, but that's beyond
my shell scripting skills at the moment.

It may be easer just to say use one or the other in the installation
document :)

Cheers,
Gary.
Reply all
Reply to author
Forward
0 new messages