bat 重启tomcat(包括部署)
前提要求:Tomcat有bin目录,并且有startup和shutdown批处理。
配置:下面的另存为bat,放在tomcat的bin目录下
@echo off
cd..
set tomcathome=%cd%
rem set tomcathome=G:\www\Tomcat7.0
echo TOMCAT_HOME=%tomcathome%
set tomcatbin=%tomcathome%\bin
set srcfile=H:\soft\DASP-MTS.war
set desfile=%tomcathome%\webapps\xxxxx.war
set workdir=%tomcathome%\webapps\xxxxx
REM stop tomcat
echo stop tomcat...
start /d %tomcatbin% shutdown.bat /b /wait
ping -n 5 127.0.1 > nul
REM delete work dir
echo delete work dir
:deleteworkdir
rd %workdir% /s /q
echo ...
if exist %workdir% goto deleteworkdir
:deleteworktemp
echo deleteworktemp
rd %tomcathome%\work\Catalina\localhost\DASP-MTS /s /q
echo ...
if exist %tomcathome%\work\Catalina\localhost\DASP-MTS goto deleteworktemp
echo start tomcat...
REM 把war文件拷贝到tomcat的webapp下,根据需要这一步可以省略
copy %srcfile% %desfile% /y
REM 启动tomcat
start /d %tomcatbin% startup.bat /b /wait