I have a process that listens on a TCP port (?0003). From time to time it crashes - badly. It stops working, but continues hogging the port for some time, so I can't even restart it. I'm looking to automate this.
What I do right now is:
netstat -ntlp |grep -P "\*\:\d0003"
To see what the PID is and then:
kill -9 <pid>
Does anyone have a script (or EXE for that matter) that would link the two steps together, ie. parse the PID from the first command and pass it to the second?