#!/bin/sh

cd `dirname $0`
JAVA=`which java`
SERVER_HOME=/opt/flarmradar/server
SERVER_LOG=$SERVER_HOME/standalone/log

[ -n "$JAVA" ] || { echo "No Java Runtime Environment found" && exit 1; }

echo "Start db .."
nohup $JAVA -cp $SERVER_HOME/modules/com/h2database/h2/main/h2-1.3.161.jar org.h2.tools.Server -baseDir ./data $@ > $SERVER_LOG/h2.out &
echo " " 
echo "  The databse is now starting, check output in $SERVER_LOG/h2.out"

sleep 3

echo "Start Flarmradar Server .."
nohup $SERVER_HOME/bin/standalone.sh > /dev/null &
echo " "
echo "  The server is now starting, check output in $SERVER_LOG/server.log"

