#!/usr/pkg/bin/bash
if [ ! $1 ]
then
    echo "Usage: pbrowse [project]"
    exit
fi
ROOT_DIR=.
PROJECT=${1}
if [[ $PROJECT != /* ]]
then
    PROJECT=`pwd`/${PROJECT}
fi
mongoose -r /usr/pkg/bin > /dev/null & 
MONGOOSE_PID=$!
open http://localhost:8080/pbrowse.cgi?proj=${PROJECT} &
echo "Running pbrowse [ "${PROJECT}" ]"
read -n 1 -s
# shut down mongoose
disown $MONGOOSE_PID
kill -9 $MONGOOSE_PID
echo "Exiting pbrowse..."
