清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/bin/sh # 执行脚本命令 "sh rt.sh 项目名" PRO_NAME=$1 #项目名 PRO_PID="" #项目进程ID PRO_PATH="/data/project/"$PRO_NAME"/" PRO_STARTUP=$PRO_PATH"tomcat/bin/startup.sh" function getPID(){ PRO_PID="" PRO_PID=$(ps -ef|grep $1 |awk '{if(match($8,"java")>0)print $2;}') } if [ ! -d $PRO_PATH ] then echo "项目不存在" else getPID $PRO_NAME if [ ! -z $PRO_PID ] then kill -9 $PRO_PID getPID $PRO_NAME if [ -z $PRO_PID ] then echo "kill成功" fi fi if [ -z $PRO_PID ] then if [ ! -f $PRO_STARTUP ] then echo $PRO_STARTUP "不存在" else sh $PRO_STARTUP getPID $PRO_NAME if [ ! -z $PRO_PID ] then echo "启动成功,当前进程PID为:"$PRO_PID tail -f $PRO_PATH"tomcat/logs/catalina.out" else echo "启动失败" fi fi fi fi