@echo off
:: run in back!
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
:: find app pid!
set pid=0
set appName=tool
set appJarPath=e:\\storage\\app\\tool\\tool-0.0.1-SNAPSHOT.jar
echo Start find app[%appName%] pid!
for /f "tokens=1-2" %%i in ('jps ^|findstr %appName%') do (
if %%j == tool-0.0.1-SNAPSHOT.jar (
set pid=%%~i
)
)
echo app[%appName%] pid:%pid%
:: start or restart!
if %pid% GTR 0 (
echo Start kill pid:%pid%
taskkill /f /pid %pid%
ping -n 5 127.0.0.1>nul
echo app[%appName%] already stop,next restart!
java -jar -server -Xms256m -Xmx256m -Xmn141m -XX:MaxMetaspaceSize=128m -Xverify:none -XX:+DisableExplicitGC %appJarPath% --spring.profiles.active=local2Test --spring.main.allow-bean-definition-overriding=true --id.generator.machine=179
) else (
echo App[%appName%] not running,start run!
java -jar -server -Xms256m -Xmx256m -Xmn141m -XX:MaxMetaspaceSize=128m -Xverify:none -XX:+DisableExplicitGC %appJarPath% --spring.profiles.active=local2Test --spring.main.allow-bean-definition-overriding=true --id.generator.machine=179
)
|