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