diff options
author | Dimitris Kavvathas <dimitris.kavvathas@sonarsource.com> | 2022-08-08 15:30:22 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-08-08 20:03:03 +0000 |
commit | 91bb6faaafe45bb8ee90ec91d39cb556e7da1f5b (patch) | |
tree | 988bbd045e40ac0522649d74287fef228d10d8d9 | |
parent | 98f9feb78ba9e384649ba3953c8154c50c05e3b7 (diff) | |
download | sonarqube-91bb6faaafe45bb8ee90ec91d39cb556e7da1f5b.tar.gz sonarqube-91bb6faaafe45bb8ee90ec91d39cb556e7da1f5b.zip |
Add realpath and check for running service
-rwxr-xr-x | sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat index 3214ab5ea1a..500b5cbe8f3 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat @@ -24,8 +24,10 @@ set JAVA_EXE="java" rem DO NOT EDIT THE FOLLOWING SECTIONS
+set REALPATH=%~dp0
call :check_if_sonar_is_running FAIL || goto:eof
+echo Starting SonarQube...
%JAVA_EXE% -Xms8m -Xmx32m^
-Djava.awt.headless=true^
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED^
@@ -34,11 +36,18 @@ call :check_if_sonar_is_running FAIL || goto:eof --add-opens=java.base/sun.nio.ch=ALL-UNNAMED^
--add-opens=java.management/sun.management=ALL-UNNAMED^
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED^
- -cp "..\..\lib\sonar-application-@sqversion@.jar" "org.sonar.application.App"
+ -cp "%REALPATH%..\..\lib\sonar-application-@sqversion@.jar" "org.sonar.application.App"
goto:eof
:check_if_sonar_is_running
+set "SQ_SERVICE="
+for /f %%i in ('%REALPATH%/SonarService.exe status') do set "SQ_SERVICE=%%i"
+if [%SQ_SERVICE%]==[Started] (
+ echo ERROR: SonarQube is already running as a service.
+ exit /b 1
+)
+
set "SQ_PROCESS="
where jps >nul 2>nul
if %errorlevel% equ 0 (
|