Stop a process from listening to specific port but not kill it?

1

On linux. I stopped tomcat which was listening on port 80 using dtomcat5. I think that was the graceful stop? I cannot start it again because java continues to listen on port 80. Is there any way to stop the java process from listening on port 80 without killing it? The java process is being used by much more than tomcat so killing it would amount to my needing to restart the whole system. Thanks.

Charlie Wilson

Posted 2012-12-04T19:52:08.277

Reputation: 501

What Java you speak of? Run-Time? Server? – Chad Harrison – 2012-12-04T19:56:23.243

It is run-time. – Charlie Wilson – 2012-12-04T20:04:35.793

Answers

1

It is up to a program to establish, maintain, and destroy the ports they use. as such, unless the program itself has a command to stop listening on a port, there is no way for another program (or the os) to release the port. Killing the process will release the port, but the current program can keep it open for as long as it runs if it likes.

i am a little confused by your description of the process model. if you run 'sudo netstat -ntlup', what is the name of the process that is listening on 80? usually if you run 6 java programs, you end up with 6 java processes, and you can kill any one of them any time you like without impacting the others. can you please explain?

Frank Thomas

Posted 2012-12-04T19:52:08.277

Reputation: 29 039

Process is java. I am pretty sure it is spawned by another java application than tomcat that I'd prefer not to stop. No matter. I think you've answered my question. I'll have to kill the process regardless. I don't think there is any way to command the process to stop listening. – Charlie Wilson – 2012-12-04T20:28:04.770