一、啟動腳本start.sh
#!/bin/sh isExist=`ps -ef | grep MonitorAndImprove | grep -v grep | awk '{print $2}'` if [ ! -z "$isExist" ]; then echo "process already running!!! pid is "$isExist exit -1 fi PRGDIR=`dirname "$0"` BASEDIR=`cd "$PRGDIR" ; pwd` CLASSPATH=$BASEDIR/config:$BASEDIR/lib/* nohup java -Xmx2g -Xms2g -classpath "$CLASSPATH" \ com.tencent.apd.MonitorAndImprove \ > log/out.log 2>& 1 & echo $! > progressId.pid
二、停止腳本stop.sh
#!/bin/sh if [ -f "progressId.pid" ] ; then kill -9 `cat progressId.pid` rm progressId.pid fi isExist=`ps -ef | grep MonitorAndImprove | grep -v grep | awk '{print $2}'` if [ ! -z "$isExist" ]; then kill -9 $isExist fi
三、重啟腳本restart.sh
#!/bin/sh sh stop.sh sh start.sh
————————————————
版權聲明:本文為CSDN博主「cxy1991xm」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/cxy1991xm/article/details/90447631