Linux 启动、停止、重启tomcat工具(Shell脚本)


 

1.   启动

#!/bin/bash

pids=`ps -ef | grep java | grep -w tomcat | awk '{print $2}'`
#pids=`ps -ef | grep -w tomcat | grep -v "grep" | awk '{print $2}'`

if test -z $pids
then
    bash /root/soft/tomcat/bin/startup.sh
    echo -e "Start Finished!\n"
else
   echo -e "tomcat has already started!\n"
fi

 

 

2.  停止

#!/bin/bash

pids=`ps -ef | grep java | grep -w tomcat | awk '{print $2}'`
#pids=`ps -ef | grep -w tomcat | grep -v "grep" | awk '{print $2}'`

for pid in ${pids}
do
    kill -9 ${pid}
done

echo -e "Stop Finished!\n"

 

 

3.  重启

#!/bin/bash

pids=`ps -ef | grep java | grep -w tomcat | awk '{print $2}'`
#pids=`ps -ef | grep -w tomcat | grep -v "grep" | awk '{print $2}'`

for pid in ${pids}
do
    kill -9 ${pid}
done

# start
bash /root/soft/tomcat/bin/startup.sh

echo -e "Restart Finished!\n"

 

 

 

.


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM