I have a legacy application (that I do not control) that occasionally crashes without properly closing the ports it is listening on. Is there a Solaris command to stop listening on a given port, short of rebooting the box?
Well. You need to find the process that's gone zombie, or has ceased being usable, to find the port that's still open. If you know the process name or PID, that's very helpful to use with commands like
I have a script that can search PIDs or process-names for open ports.
That will print the PID, processname, and any sockets open for any process that matches $1.
Once you know exactly which PID is holding that socket open, and not being usable, you can use one of the
If the post is still in the listening state then the application is still somehow running. Use the command lsof -i to check which process is still listening and kill it.
If you don't have the lsof tool installed, you have to search the ps -ef for still running processes of your application.