shell 执行jar 的命令

#!/bin/sh
##############
#判断是否程序已启动
jappname='Test'
mainclasspath="com.company.commontest.test"
javaps=`jps`
i=0
psid=0
for psresult in $javaps
do
let cur=i%2
if [ $cur -eq 0 ]; then
psid=$psresult
else
if (test "$psresult" = "$jappname")
then
echo "程序"$jappname"[pid="$psid"]已经启动!"
exit 0
fi
fi
let i++;
done
#引入依赖类库到类路径
classpath="."
classpath="$classpath:commontest-0.0.1-SNAPSHOT.jar"
classpath="$classpath:spring-context.xml"
classpath="$classpath:log4j.properties"
pathtmp=''
for jarpath in `ls lib/*.jar`
do
classpath=$classpath:$jarpath
done
echo $classpath
echo $mainclasspath
nohup java -server -XX:-UseGCOverheadLimit -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M -classpath $classpath $mainclasspath >std.out 2>&1 &

上一篇:缓存一致性问题(七)


下一篇:C# 串口操作系列(3) -- 协议篇,二进制协议数据解析