I have a server running on a local server. Every once in a while it will freeze up, and I'll need to use a Ctrl+Z to cancel out of it. The issue is that the port it uses is still open to it after I force close it, and it can't reclaim that port when I restart the program. So then I need to restart the entire server.
Is there a way I could force that port closed, so the service could open it when it starts back up, or maybe refresh all the ports?
Thanks,
max
Best Answer
ctrl-z is a suspend.
You probably want ctrl-c.
You can also send a signal to the individual PID. For example, if I wanted to close port 80, I could first query open files with lsof:
httpd 24579 root 3u IPv6 142712111 TCP *:http (LISTEN)
Then send a kill signal: