34

I use sonarqube 4.3 and I can't find a script to stop sonar in windowsx86-64.

It's awkward to have StartSonar.batand nothing to stop.

When I use it on in linux-x86-64 I can use ./sonar.sh stop.

I saw that there was a StartNTService.bat and a StoptNTService.bat but i don't want to install sonar as a service.

1
  • 2
    My SonarQube didn't show up in the processes nor in services in the Windows Tasts Manager. I just had to kill my Java processes.
    – Vulpo
    Commented Feb 26, 2016 at 10:28

13 Answers 13

19

First try to stop the SonarStart.bat by using Ctrl+c as suggested , and then try to open localhost:9000 ( or whichever port you configured sonar server).

If it is still opening then go to task manager and search for wrapper.exe service and stop the service, if no service or app is found then goto:

Task manager>Details> and stop all java.exe process. 

enter image description here

Note: If you running many java applications, right-click the java.exe and choose goto service, and stop only those java.exe that belongs to AppX deployment.

0
15

When using StartSonar.bat:

  • if you clicked on it, it opened a new Command window and in this case you just have to close the window to stop SonarQube

  • or you executed the script directly in a Command window, and in this case you just have to hit "Control + C" to stop SonarQube

6
  • 6
    Ctr+C or closing the window didn't give me the feeling I was properly shutting down sonar. Thanks for the answer. Commented May 29, 2014 at 15:50
  • 7
    No, sonar is still running on win 7 64
    – amdev
    Commented Oct 21, 2015 at 13:04
  • I tried closing the Window, didn't work. Ctrl+C worked like a charm.
    – Henry
    Commented Dec 18, 2015 at 9:53
  • Ctrl+C is the right way, SonarQube code hooks with ESCAPE code and starts stopping server once you press that. You can confirm this form log on console. Killing process is bad.
    – SACn
    Commented Sep 26, 2017 at 13:49
  • On Windows Server 2016 I had to press Ctrl+C repeatedly in the Command window before the Java Service Wrapper detected the Ctrl-C. Once detected, this wrapper shuts down SonarCube (I am running version 7.2.1).
    – MikeOnline
    Commented Jul 24, 2018 at 20:03
11

First find the process id using port number. It will be great if you have git have installed where you can execute few linux commands.

Get the process ID

Once you get the process id, just kill the process. It's that much simple. Execute the below command from the normal cmd window.

enter image description here

9

If you just run sonarqube for demo purposes via .\StartSonar.bat and this is the only java application you use, you can always do the following command which ends the JRE (sometimes CTRL + C does not always stop the running batch file) - you just need to run it as admin.

StopSonar.bat

@powershell kill -name java
5

Open the windows files managment (CTL+ALT+DEL) and kill the jre process of your sonar server. May be you can't kown which process it is if you have more than one. In my case I kill them all.

2

From my experience I recommend to stop your SonarQube using the command "ctrl + c" (Don't close the command line window without do this).

If you have closed the StartSonar.bat command line without hitting "ctrl + c", you may see your Sonar still running, in this case you will need to kill manually the Java Processes as @arcuri82 mentioned in the Task Manager .

1

I have the exact same problem (on Windows 7). Even when I close the Command window, still SonarQube is running. A "dirty" workaround is to use Java Visual VM (part of the JDK distribution) to see the pid of the Java processes spawn by SonarQube, and then kill them manually from Windows Task Manager (be sure to click on View first to make the pid value column visible).

1

Pressing Ctrl + C repeatedly worked for me.

0

Simplest way is :

press ctrl+c on background console which is running for sonar

0

Don't kill process as this could leave resources opened (not recommended). SonarQube console app is programmed to trap Ctrl-C and terminate safely. This can be verified from its console output manually - after we press break.

Instead send break to process using 3rd party application in a new batch file maybe names StopSonar: SendSignal.exe. Format for this is:

SendSignal <pid> <pid> - send ctrl-break to process <pid> (hex ok)

0

In windows. If you start SonarQube using StartNTService.bat

Then open start menu, search Services find SonarQube right click and stop that service. You can change restart policy to manual if you want. Work for me

If you start using StartSonar.bat then press Ctrl + C on it's terminal window

0

Use UninstallNTService.bat to stop and remove the SonarQube

0
-1

Start or Stop the Instance

Start:

sonar.sh start

Start:

sonar.sh console

Graceful shutdown:

sonar.sh stop

Hard stop:

sonar.sh force-stop

Please read Configure & Operate the Server

Not the answer you're looking for? Browse other questions tagged or ask your own question.