Skip to content

Commit

Permalink
Updated springboot start, stop scripts for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian committed Dec 5, 2017
1 parent f276d68 commit b16e7fd
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 4 deletions.
69 changes: 69 additions & 0 deletions dist/src/main/bin/springboot.bat
@@ -0,0 +1,69 @@
@echo off

setlocal

set "BIN_DIR=%~dp0%~2"
if not "%MIDPOINT_HOME%" == "" goto gotHome
cd "%BIN_DIR%.."
mkdir var
cd var
mkdir log
cd "%BIN_DIR%.."
set "MIDPOINT_HOME=%cd%\var"
echo %MIDPOINT_HOME%
echo %BIN_DIR%
:gotHome

rem if script for start and stop exists
if exist "%BIN_DIR%\springboot.bat" goto okBoot
echo %BIN_DIR%
echo The springboot.bat file is not in \bin directory or is no accessible
goto end
:okBoot

rem if start/stop out file exists
if not "%BOOT_OUT%" == "" goto okOut
set "BOOT_OUT=%MIDPOINT_HOME%\log\springboot.out"
echo %BOOT_OUT%
:okOut

rem MIDPOINT_WAR if not defined
if exist "%cd%\lib\midpoint.war" goto gotWar
echo The midpoint.war is not in \lib directory
echo Can not start midPoint
goto end
:gotWar

if "%MIDPOINT_HOME%" == "%MIDPOINT_HOME:;=%" goto homeNoSemicolon
echo Using MIDPOINT_HOME: "%MIDPOINT_HOME%"
echo Unable to start as MIDPOINT_HOME contains a semicolon (;) character
goto end
:homeNoSemicolon


rem ----- Execute The Requested Command ---------------------------------------

echo Using MIDPOINT_HOME: "%MIDPOINT_HOME%"

set _EXECJAVA=%_RUNJAVA%
set _NOHUP=nohup
set ACTION=start

if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop

:doStart
shift
goto execStart

:doStop
shift
goto execStop

:execStart
echo "%cd%\lib\midpoint.war"
start /b javaw -jar -Xms2048M -Xmx2048M -Djavax.net.ssl.trustStore=%MIDPOINT_HOME%\keystore.jceks -Djavax.net.ssl.trustStoreType=jceks -Dmidpoint.home=%MIDPOINT_HOME% %cd%\lib\midpoint.war > %BOOT_OUT% 2>&1 &

:execStop
echo "%cd%\lib\midpoint.war"
FOR /F "usebackq tokens=5" %%i IN (`netstat -aon ^| findstr "0.0.0.0:8080"`) DO taskkill /F /PID %%i
45 changes: 43 additions & 2 deletions dist/src/main/bin/start.bat
@@ -1,2 +1,43 @@
echo "Starting midPoint"
java -jar -Xms1024M -Xmx2048M -Dmidpoint.home=%~dp0%~1..\var %~dp0%~1..\lib\midpoint.war
@echo off

setlocal

set "BIN_DIR=%~dp0%~1"
if not "%MIDPOINT_HOME%" == "" goto gotHome
cd "%BIN_DIR%.."
mkdir var
cd var
mkdir log
cd "%BIN_DIR%.."
set "MIDPOINT_HOME=%cd%\var"
echo %MIDPOINT_HOME%
:gotHome

if exist "%BIN_DIR%\springboot.bat" goto okHome
echo The MIDPOINT_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%BIN_DIR%\springboot.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

:end

45 changes: 43 additions & 2 deletions dist/src/main/bin/stop.bat 100755 → 100644
@@ -1,2 +1,43 @@
echo "Stopping midPoint"
FOR /F "usebackq tokens=5" %%i IN (`netstat -aon ^| find "8080"`) DO taskkill /F /PID %%i
@echo off

setlocal

set "BIN_DIR=%~dp0%~1"
if not "%MIDPOINT_HOME%" == "" goto gotHome
cd "%BIN_DIR%.."
mkdir var
cd var
mkdir log
cd "%BIN_DIR%.."
set "MIDPOINT_HOME=%cd%\var"
echo %MIDPOINT_HOME%
:gotHome

if exist "%BIN_DIR%\springboot.bat" goto okHome
echo The MIDPOINT_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%BIN_DIR%\springboot.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" stop %CMD_LINE_ARGS%

:end

0 comments on commit b16e7fd

Please sign in to comment.