tomcat挂掉后自动重启脚本

PROG_NAME=tomcat
PROG_PATH=$(pwd)
PROG_START=startup.sh


# kill program if exist
#force shutdown tomcat,copy this sh file to tomcat/bin dir
echo "exec ./shutdown.sh"
$PROG_PATH/shutdown.sh
sleep 3s
#kill -9 pid
ps -ef|grep $PROG_PATH|grep java|awk '{print $2}'|xargs kill -9


#success msg
echo "shutdown success"


# polling check
while true; do
 PROG_NUM=`ps -ef | grep $PROG_NAME | grep -v grep | wc -l`
 if [ $PROG_NUM -lt 1 ]; then
  $PROG_PATH/$PROG_START > /dev/null 2>&1
  echo "start success"
 fi
 sleep 1
done
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页