jar 启动脚本
2021-04-07 本文已影响0人
YANG_ad29
#!/bin/bash
jarbao="corss-1.0.0"
case $1 in
start)
geshu1=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|wc -l`
if [ $geshu1 == 1 ];then
echo "program is running"
else
nohup java -Xmx512m -Xms256m -jar /home/cross/"$jarbao".jar &>> /home/cross/logs/"$jarbao".log &
fi
;;
stop)
geshu=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|wc -l`
if [ $geshu == 1 ];then
pid=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|awk '{print $2}'`
kill -9 $pid
else
echo "program is stop"
fi
;;
*)
echo "Usage:[start|stop])"
esac