启动脚本

#!/bin/bash
echo ===============================
NAME=stp-web-1.0.0-SNAPSHOT
#NAME2=esbsit
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
if [ "$ID" != "" ]; then
   for id in $ID
     do
       echo "开始停止服务器..."
       kill -9 $id
     done
echo " 服务器已经停止,将开始启动..."
sleep 1
else
echo "服务器已经是停止状态,将直接启动..."
sleep 1
fi
cd /export/software
rm -rf nohup.out

nohup java -jar -Xms2g -Xmx2g -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=256M -XX:SurvivorRatio=10 -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSMaxAbortablePrecleanTime=5000 -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=80 -Xloggc:/home/appman/logs/gc.log -Duser.timezone=GMT+8 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Dsun.net.client.defaultConnectTimeout=30000 -Dsun.net.client.defaultReadTimeout=30000 -Dglobal.config.path=/export/software/dpap-config/ -XX:+UseCMSInitiatingOccupancyOnly -XX:ParallelGCThreads=4 -XX:-OmitStackTraceInFastThrow stp-web-1.0.0-SNAPSHOT.jar & 
sleep 2
tail -500f nohup.out

你可能感兴趣的:(Linux)