@echo off rem ******************************************************************************* rem Licensed Materials - Property of IBM rem (c) Copyright IBM Corporation 2017, 2020. All Rights Reserved. rem rem Note to U.S. Government Users Restricted Rights: rem Use, duplication or disclosure restricted by GSA ADP Schedule rem Contract with IBM Corp. rem ******************************************************************************* setlocal rem Must start the script from the folder where it is located. pushd "%~dp0" set SCRIPT_DIR=%CD% set SCRIPT_NAME=%~n0 set SERVICE_NAME=dcm set ACTION=stop :getargs if -%1-==-- goto :endargs set A=%~1 if "%A%"=="-name" ( if "%2"=="" goto :usage set SERVICE_NAME=%2 shift ) else if "%A%"=="-service" ( set ACTION=stopWinService ) else if not defined JAVA_HOME ( set JAVA_HOME=%A% ) else ( goto :usage ) shift goto :getargs :usage echo Usage: %SCRIPT_NAME% [-service [-name serviceName]] [^] goto :END :endargs rem set JAVA_HOME if not set if not defined JAVA_HOME ( set JAVA_HOME=%SCRIPT_DIR%\..\..\jre\bin ) if NOT exist "%JAVA_HOME%\java.exe" ( echo JRE not found at "%JAVA_HOME%" goto :END ) if "%LOG_DIR%" == "" ( set LOG_DIR=logs ) set PRUNSRV=%SCRIPT_DIR%\tools\win\prunsrv.exe if NOT exist "%PRUNSRV%" ( set PRUNSRV=%SCRIPT_DIR%\..\..\liberty\wlp\bin\tools\win\prunsrv.exe ) if NOT %ACTION%==stop ( if NOT exist "%PRUNSRV%" ( echo %PRUNSRV% not found goto :END ) ) call :%ACTION% goto :END :stop echo Stopping microservice... if NOT exist "%SCRIPT_DIR%\service.lck" ( echo Service lock file not found, service may not be running... ) "%JAVA_HOME%\java.exe" -jar distributedCache.jar stop goto :eof :stopWinService "%PRUNSRV%" //SS//%SERVICE_NAME% goto :eof :END popd endlocal