Jpom/script/Jpom.bat

117 lines
3.5 KiB
Batchfile
Raw Normal View History

2019-04-05 12:04:16 +08:00
@REM The MIT License (MIT)
2019-03-15 18:43:42 +08:00
@REM
2019-04-12 18:37:15 +08:00
@REM Copyright (c) 2019 <20><>֮<EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2019-03-15 18:43:42 +08:00
@REM
2019-04-05 12:04:16 +08:00
@REM Permission is hereby granted, free of charge, to any person obtaining a copy of
@REM this software and associated documentation files (the "Software"), to deal in
@REM the Software without restriction, including without limitation the rights to
@REM use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@REM the Software, and to permit persons to whom the Software is furnished to do so,
@REM subject to the following conditions:
2019-03-15 18:43:42 +08:00
@REM
2019-04-05 12:04:16 +08:00
@REM The above copyright notice and this permission notice shall be included in all
@REM copies or substantial portions of the Software.
@REM
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@REM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
@REM FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
@REM COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
@REM IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@REM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2019-03-15 18:43:42 +08:00
@REM
2019-03-21 10:12:06 +08:00
@echo off
setlocal enabledelayedexpansion
2019-03-15 18:43:42 +08:00
2019-04-12 18:11:02 +08:00
set Tag=KeepBx-System-JpomApplication
2019-03-21 10:12:06 +08:00
set MainClass=cn.keepbx.jpom.JpomApplication
2019-04-12 18:37:15 +08:00
set CloseMainClass=cn.keepbx.jpom.JpomClose
2019-03-21 10:12:06 +08:00
set basePath=%~dp0
set Lib=%basePath%lib\
set Log=%basePath%run.log
2019-04-12 18:37:15 +08:00
set LogBack=%basePath%log\
2019-03-21 10:12:06 +08:00
set JVM=-server
set ARGS= --jpom.applicationTag=%Tag% --jpom.log=%basePath%log --server.port=2122
2019-03-15 18:43:42 +08:00
2019-04-12 18:11:02 +08:00
color 0a
2019-04-12 18:37:15 +08:00
TITLE Jpom<6F><6D><EFBFBD><EFBFBD>ϵͳBAT<41><54><EFBFBD><EFBFBD>̨
echo. ***** Jpom<6F><6D><EFBFBD><EFBFBD>ϵͳBAT<41><54><EFBFBD><EFBFBD>̨ *****
2019-04-12 18:11:02 +08:00
::*************************************************************************************************************
echo.
2019-04-12 18:37:15 +08:00
echo. [1] <20><><EFBFBD><EFBFBD> start
echo. [2] <20>ر<EFBFBD> stop
echo. [3] <20><EFBFBD><E9BFB4><EFBFBD><EFBFBD>״̬ status
echo. [4] <20><><EFBFBD><EFBFBD> restart
echo. [5] <20><><EFBFBD><EFBFBD> use
echo. [0] <20><> <20><> 0
2019-04-12 18:11:02 +08:00
echo.
2019-04-12 18:37:15 +08:00
echo.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
2019-04-12 18:11:02 +08:00
set /p ID=
2019-04-12 18:37:15 +08:00
IF "%id%"=="1" goto start
IF "%id%"=="2" goto stop
IF "%id%"=="3" goto status
IF "%id%"=="4" goto restart
IF "%id%"=="5" goto use
2019-04-12 18:11:02 +08:00
IF "%id%"=="0" EXIT
PAUSE
2019-04-12 18:37:15 +08:00
echo <20><><EFBFBD><EFBFBD><EFBFBD>رմ<D8B1><D5B4><EFBFBD>
timeout 3
EXIT 1
2019-04-12 18:11:02 +08:00
2019-04-12 18:37:15 +08:00
@REM <20><><EFBFBD><EFBFBD>
:start
2019-04-13 11:18:44 +08:00
if "%JAVA_HOME%"=="" (
echo <20><><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>JAVA_HOME<4D><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PAUSE
EXIT 2
)
2019-04-12 18:37:15 +08:00
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
if exist %Log% (
if not exist %LogBack% (
echo %LogBack%
md %LogBack%
)
move %Log% %LogBack%%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%.log
del %Log%
)
set TEMPCLASSPATH=
for /f "delims=" %%I in ('dir /B %Lib%') do (set TEMPCLASSPATH=!TEMPCLASSPATH!%Lib%%%I;)
REM echo <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>رմ<D8B1><D5B4>ڲ<EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.....<2E>رմ<D8B1><D5B4>ڲ<EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
javaw %JVM% -classpath %TEMPCLASSPATH%"%JAVA_HOME%"\lib\tools.jar -Dapplication=%Tag% -Dbasedir=%basePath% %MainClass% %ARGS% >> %Log%
timeout 3
goto:eof
2019-04-12 18:37:15 +08:00
@REM <20>ر<EFBFBD>Jpom
:stop
2019-04-12 18:37:15 +08:00
set TEMPCLASSPATH=
for /f "delims=" %%I in ('dir /B %Lib%') do (set TEMPCLASSPATH=!TEMPCLASSPATH!%Lib%%%I;)
java -classpath %TEMPCLASSPATH%"%JAVA_HOME%"\lib\tools.jar %CloseMainClass% %ARGS% --jpom.applicationTag=%Tag% --event=stop
goto:eof
2019-04-12 18:37:15 +08:00
@REM <20>鿴Jpom<6F><6D><EFBFBD><EFBFBD>״̬
:status
2019-04-12 18:37:15 +08:00
set TEMPCLASSPATH=
for /f "delims=" %%I in ('dir /B %Lib%') do (set TEMPCLASSPATH=!TEMPCLASSPATH!%Lib%%%I;)
java -classpath %TEMPCLASSPATH%"%JAVA_HOME%"\lib\tools.jar %CloseMainClass% %ARGS% --jpom.applicationTag=%Tag% --event=status
goto:eof
2019-04-12 18:37:15 +08:00
@REM <20><><EFBFBD><EFBFBD>Jpom
:restart
2019-04-12 18:37:15 +08:00
echo ֹͣ<CDA3><D6B9>....
call:stop
timeout 3
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>....
call:start
goto:eof
2019-03-15 18:43:42 +08:00
2019-04-13 11:18:44 +08:00
@REM <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>Nginx
:reloadNginx
nginx -s reload
goto:eof
2019-04-12 18:37:15 +08:00
@REM <20><>ʾ<EFBFBD>÷<EFBFBD>
:use
2019-04-12 18:37:15 +08:00
echo please use (start|stop|restart|status)
goto:eof