linux 启动停止jar

start.sh

#!/bin/bash
PWDPATH=`dirname $0`
PORTAL_HOME=`cd $PWDPATH && cd .. && pwd`
echo $PORTAL_HOME
cd $PORTAL_HOME
JVM_OPTS="
-server
 -Xms2g
 -Xmx2g
 -XX:+UseG1GC
 -XX:MaxGCPauseMillis=200
 -XX:+DisableExplicitGC
 -XX:+PrintGCDetails
 -XX:-UseGCOverheadLimit
 -XX:+HeapDumpOnOutOfMemoryError
 -XX:+PrintGCDateStamps
 -Xloggc:logs/gc.log
"

start() {
nohup java $JVM_OPTS -Dlogging.config=$PORTAL_HOME/config/log4j2-spring.xml -jar $PORTAL_HOME/lib/cactus-1.0.0.jar &> /dev/null &
echo -e '\r'
}
logs_dir=$PORTAL_HOME/logs
if [ ! -d "$logs_dir" ]; then
        mkdir $logs_dir
fi

start

stop.sh

#!/bin/bash
ps -ef|grep cactus-1.0.0.jar|grep -v grep|awk '{print $2}'|xargs kill -9

 

#!/bin/bash

PWDPATH=`dirname $0`
PORTAL_HOME=`cd $PWDPATH && cd .. && pwd`
echo $PORTAL_HOME
cd $PORTAL_HOME
JVM_OPTS="
-server 
 -Xms1g
 -Xmx1g
 -XX:NewSize=512m
 -XX:SurvivorRatio=6
 -XX:+AlwaysPreTouch
 -XX:+UseG1GC
 -XX:MaxGCPauseMillis=2000
 -XX:GCTimeRatio=4
 -XX:InitiatingHeapOccupancyPercent=30
 -XX:G1HeapRegionSize=8M
 -XX:ConcGCThreads=2
 -XX:G1HeapWastePercent=10
 -XX:+UseTLAB
 -XX:+ScavengeBeforeFullGC
 -XX:+DisableExplicitGC
 -XX:+PrintGCDetails
 -XX:-UseGCOverheadLimit
 -XX:+PrintGCDateStamps
 -Xloggc:logs/gc.log
"

start() {
nohup java $JVM_OPTS -Dlogging.config=config/log4j2.xml -jar lib/netParse-decrypt-1.0.jar &
echo -e '\r'
}

start >> /dev/null 2>> /dev/null

 

posted @ 2021-09-29 17:33  tonggc1668  阅读(104)  评论(0编辑  收藏  举报