#! /bin/bash

export JAVA_HOME= <insert java home directory (no trailing path separator)>
export CATALINA_HOME= <insert Tomcat 4.1.x home directory (no trailing path separator)>
export CATALINA_BASE=$CATALINA_HOME

CONFIG_OPT=-Dmoa.id.configuration=$CATALINA_BASE/conf/moa-id/SampleMOAIDConfiguration.xml
LOGGING_OPT=-Dlog4j.configuration=file:$CATALINA_BASE/conf/moa-id/log4j.properties
SPSS_OPT=-Dmoa.spss.server.configuration=$CATALINA_BASE/conf/moa-spss/SampleMOASPSSConfiguration.xml

#TRUST_STORE_OPT=-Djavax.net.ssl.trustStore=$CATALINA_BASE/conf/moa-spss/keys/clients/trustedMOAClients-password=changeit.keystore
#TRUST_STORE_PASS_OPT=-Djavax.net.ssl.trustStorePassword=changeit
#TRUST_STORE_TYPE_OPT=-Djavax.net.ssl.trustStoreType=jks

export CATALINA_OPTS="$CONFIG_OPT $LOGGING_OPT $SPSS_OPT $TRUST_STORE_OPT $TRUST_STORE_PASS_OPT $TRUST_STORE_TYPE_OPT"

echo CATALINA_HOME: $CATALINA_HOME
echo CATALINA_BASE: $CATALINA_BASE
echo CATALINA_OPTS: $CATALINA_OPTS

echo 
echo Moving old log files to logs\backup
mv logs/*.out logs/backup
mv logs/*.txt logs/backup
mv logs/*.log logs/backup

cd $CATALINA_HOME
./bin/startup.sh