3

Tomcat重启脚本For Windows

 3 years ago
source link: https://zhang.ge/378.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Tomcat重启脚本For Windows

Jager · 12月27日 · 2013年tomcat · 批处理 6392次已读

Tomcat重启脚本,送给有需要的JSP环境运维同行们~

运行环境:XP/windows 2003测试通过,其他环境由于手头上条件限制未测试;

脚本功能:在常规调用tomcat自带的关闭/重启脚本中加入假死判断,若出现假死则予以强行Kill掉相关JAVA进程;

脚本特点:可在tomcat/Jboss/apache混合平台使用,针对性的只重启tomcat相关进程;

注意事项:就是注意tomcat环境变量是否正确即可。

@echo off
title Tomcat重啟脚本
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"

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK