#!/bin/sh
#
# geneweb:       Starts the genealogy Server 
# description: Starts and stops the genealogy Server at boot time and shutdown.
#

GWLANG=$(/sbin/e-smith/db configuration getprop sysconfig Language | sed -e 's/_.*$//')
BD=$(/sbin/e-smith/db configuration getprop geneweb DBDir || echo "/opt/geneweb/bases")
HD="/opt/geneweb/gw/gw"
BIN=$HD/gwd
LOGF="/var/log/gwd.log"

start() {
	echo -n "Starting GeneWeb Services (geneweb):"
	$BIN -daemon -hd $HD -bd $BD -lang $GWLANG
        /bin/su -s /bin/bash geneweb -c "$BIN -daemon -hd $HD -bd $BD -lang $GWLANG >>$LOGF 2>>\&1"
}

cd $BD

case "$1" in
	start)
	    $1
	    ;;
	*)
	    echo "*** Usage: geneweb {start}"
	    exit 1
	    ;;
esac

exit 0
