linux java启动脚本示例

start.sh

#!/bin/bash
nohup /usr/jdk1.8.0_102/bin/java -jar -Xms400m -Xmn200m -Xmx500m -Dtwasp.config.uri=http://192.168.128.132:9300/configs -Deureka.client.serviceUrl.defaultZone=http://192.168.128.132:9100/eureka/ -Deureka.client.register-with-eureka=true /home/aaa-1.0.2-exc.jar > aaa.log 2>&1 &

 

stop.sh

#!/bin/bash
PID=$(ps -ef | grep aaa-1.0.2-exc.jar | grep -v grep | awk '{ print $2 }')
if [ -z "${PID}" ];
then
echo 'aaa-1.0.2-exc.jar is already stopped...'
else
echo 'aaa-1.0.2-exc.jar is stpping...'
echo kill $PID DONE
kill -9 $PID
fi

 

 

sh start.sh

sh stop.sh

posted @ 2023-07-22 11:12  漫步CODE人生  阅读(88)  评论(0编辑  收藏  举报