# Run mvn package # Goto Dir echo "---- Script Running -----" echo "in : "$0 echo "$(realpath $(dirname $0)/..)" SERVER_PATH=$(realpath $(dirname $0)/..)"/sourcecode/server" if [ ! -d $SERVER_PATH ] ; then echo " Using another server path : " SERVER_PATH=$(realpath $(dirname $0))"/quizapp-be/sourcecode/server" fi ORIGIN_PLACE="$SERVER_PATH/target/SZU-*.jar" CMD1="java -Djava.security.egd=file:/dev/./urandom -jar SZU-*.jar -debug" DEPLOY_DIR="$SERVER_PATH/deployed" export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64" if [ "x$1" = "x-skip" -o "x$2" = "x-skip" ] then echo "---- skipping build-server.sh " ls $DEPLOY_DIR else echo "---- removing old deployed JAR file " ls $DEPLOY_DIR rm -rf $DEPLOY_DIR/*.jar echo "---- Running build-server.sh" ./build-server.sh fi echo "Killing all Java Processes" ps -ef|grep 'java'|grep 'SZU' | grep -v grep|cut -c 9-15 ps -ef|grep 'java'|grep 'SZU' | grep -v grep|cut -c 9-15|xargs kill -9 >/dev/null 2>&1 if [ "-$2" != "--show" -a "-$1" != "--show" ] then CMD1="nohup $CMD1 &" fi which java if [ $? -ne 0 ] then echo "Cannot find java, please run : java -version to check! " exit 2 fi # Start copying mkdir $DEPLOY_DIR cd $DEPLOY_DIR echo " ---- copying, from "$(echo $ORIGIN_PLACE)" to "$(echo $DEPLOY_DIR)" ---- " cp $ORIGIN_PLACE $DEPLOY_DIR echo " ---- now inside $(pwd) ---- " echo " ---- running $CMD1 ---- " $CMD1 echo " ---- running finished with $? ! --- "