#!/bin/sh

#CB=${BATCH_HOME}/framework/classes/
CB=%BATCH_HOME%\lib\fwBatch.jar
CODEBASE=file://${CB}
POLICY=${BATCH_HOME}/sh/.java.policy
CP=${BATCH_HOME}/lib/log4j-core-2.6.2.jar

cd ${BATCH_HOME}

${JAVA_HOME}/bin/java -cp ${CP} org.apache.logging.log4j.core.net.SocketServer 20001 ${BATCH_HOME}/classes/log4j2Server.xml &

sleep 3

${JAVA_HOME}/bin/rmiregistry -J-Djava.rmi.server.codebase=${CODEBASE} 20000 &

export PATH=${BATCH_HOME}/sh:${PATH}

CP=${BATCH_HOME}/classes:${CP}:${CB}:${BATCH_HOME}/lib/postgresql-9.4.1209.jar:${BATCH_HOME}/lib/fwBase.jar

${JAVA_HOME}/bin/java -cp ${CP} -Djava.rmi.server.hostname=${HOSTNAME} -Djava.rmi.server.codebase=${CODEBASE} -Djava.security.policy=${POLICY} -Dlog4j.configuration=file:${BATCH_HOME}/classes/log4j2JM.xml batch.controller.JobManagerImpl &

unset CB
unset CP
unset CODEBASE
unset POLICY
