Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to program a server software which involves a lot of testing on java / scala platform. Whenever i compile and execute the code. It starts listening on port 80. Sometimes i need to terminate it by Ctrl+C when it hangs. In that case, ubuntu is not freeing the port. So in order to run the process, i have to restart the machine.

I see this at ps aux

root      1924  0.0  0.0   5796  1660 pts/0    T    05:44   0:00 sudo scala -
root      1925  0.2  1.5 491448 40796 pts/0    Tl   05:44   0:03 java -Xmx256M -Xms16M

So process 1924 and 1925. I did sudo kill on both these. But then they keep on persisting even after a long time.

sudo nmap -T Aggressive -A -v 127.0.0.1 -p 1-65000

Scanning localhost (127.0.0.1) [65000 ports]

Discovered open port 80/tcp on 127.0.0.1

It means its still there !

sudo netstat --tcp --udp --listening --program

tcp6       0      0 [::]:www                [::]:*                  LISTEN      1925/java
tcp6       0      0 ip6-localhost:ipp       [::]:*                  LISTEN      1185/cupsd

This means its 1925 - java

How to kill it.

share|improve this question
1  
Try kill -9 1925 (the -9 changes the signal to SIGKILL, which forces termination) –  cyberx86 Nov 25 '11 at 0:50
    
Worked ! Thanks. –  Aditya Singh Nov 25 '11 at 1:07

1 Answer 1

kill -9 sends a SIGKILL which allows you to kill any process that isn't waiting on IO.

A regular kill just sends SIGTERM which only asks the process to quit. Whereas SIGKILL tells the OS to immediately terminate the process.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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