I started a SonarQube process to listening at port 9000. Now I want to restart it for some new installation of plugins. I've forgotten where I installed SonarQube and how start it. The only clue is that it is listening at port 9000. Following is the method to shutdown it gracefully.
- Find out which process is listening at the port;
netstat -tulpn | grep :9000
produces:
tcp6 0 0 :::9000 :::* LISTEN 19059/java
So now you know the PID is 19059 and the program name is java. You can verify this by the following commands:
fuser 9000/tcp
or
lsof -i :9000
- Get detailed information of the PID:
ps -ef|grep 19059
and produces:bvt 19059 19057 ...
This means 19057 is parent of 19059. So we input ps -ef|grep 19057
and find its parent process is 19001, which parent is 1. Because 1 is init process of OS, we know 19001 is the process we should close.
- Shutdown a process gracefully:
kill 19057
;
Note: you can use "pwdx [PID]" to get the current working directory of the PID.