1. 程式人生 > >sh指令碼啟動java程式

sh指令碼啟動java程式

#!/bin/sh #專案部署路徑 WEB_HOME=/data/project/PROJECT-ONE

#jdk路徑 JAVA_HOME=/data/java/jdk1.7.0_80

#ProjrctOneClient  為main入口的類名稱

PID=`$JAVA_HOME/bin/jps | grep ProjrctOneClient | awk '{print $1}'`

if [ "" != "$PID" ] ; then     echo " ProjrctOneClient is allready running, pid($PID)"     exit 1; fi

#如果專案沒有配置log配置,可在指令碼中zhiding輸入路徑

rm -rf /data/logs/project-one.log FILE_PATH=$WEB_HOME/WEB-INF/classes

TOMCAT_HOME=/opt/tomcat

LIB_CLASS_PATH=$WEB_HOME/WEB-INF/classes

#servlet jars for file in $TOMCAT_HOME/lib/*jar do         LIB_CLASS_PATH=$LIB_CLASS_PATH:$file done

#app jars for file in $WEB_HOME/WEB-INF/lib/*.jar do         LIB_CLASS_PATH=$LIB_CLASS_PATH:$file done

$JAVA_HOME/bin/java -classpath $LIB_CLASS_PATH  com.cmcc.client.ProjrctOneClient > /data/logs/project-one.log 2>&1 &