Windows系統Tomcat重啟批處理指令碼

來源:互聯網
上載者:User


Tomcat重啟指令碼,送給有需要的JSP環境營運同行們~

運行環境:XP/windows 2003測試通過,其他環境由於手頭上條件限制未測試;

指令碼功能:在常規調用tomcat內建的關閉/重啟指令碼中加入假死判斷,若出現假死則予以強行Kill掉相關JAVA進程;

指令碼特點:可在tomcat/Jboss/apache混合平台使用,針對性的只重啟tomcat相關進程;

注意事項:就是注意tomcat環境變數是否正確即可。

@echo off
title Tomcat重?⒔瘧?br />call "%tomcat_home%\bin\shutdown.bat"
ping -n 6 127.1 >nul
wmic process where name="java.exe" get processid,commandline |findstr /i "tomcat" >#     
setlocal enabledelayedexpansion
for /f "delims=*" %%i in (#) do (     
   set var=%%i
   set var=!var:start  =#!     
   for /f "tokens=2 delims=#" %%a in ("!var!") do (
     set tomcatpid=%%a
    )
)
del # >nul     
if defined tomcatpid taskkill /pid !tomcatpid!
ping -n 3 127.1 >nul
call "%tomcat_home%\bin\startup.bat"
exit

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.