For everyone recommending the step from
kill $PID to
kill -9 $PID, I'd have to remind you of Useless use of kill -9.
No no no. Don't use kill -9.
It doesn't give the process a chance to cleanly:
shut down socket connections
clean up temp files
inform its children that it is going away
reset its terminal characteristics
and so on and so on and so on.
Generally, send 15, and wait a second or two, and if that doesn't work, send 2, and if that doesn't work, send 1. If that doesn't, REMOVE THE BINARY because the program is badly behaved!
Don't use kill -9. Don't bring out the combine harvester just to tidy up the flower pot.
Now, I don't agree with the "remove the binary part", but the progression seems less damaging than just a
I also agree with the care about race conditions on the creation of new processes with the same PID mentioned here.