Thursday, September 22, 2011

Kill a Port

Trying to start an application, but the port it needs to bind is open.  Usually this happens when the application crashes and fails to close any of its open ports.

Assume that I'm looking to 1780, since that what's my application binds to.  Use lsof to list any open files used by that port

# lsof  | grep 1780

Who's using that port?

# fuser -v 1780/tcp

                     USER        PID ACCESS COMMAND
1780/tcp:            root      22516 F.... uxwdog
                          redhat    22518 F.... ns-httpd

Got the process ID, so kill the process

# fuser -vk 1780/tcp

Check to make sure it's gone...

# fuser -v 1781/tcp

No comments:

Post a Comment