4 ms·
As I said in a comment on the OP, lsof (LiSt Open Files - it does more than its name suggests) is pretty useful too. fuser is useful too, and available on many
by vram22 9y ago
As I said in a comment on the OP, lsof (LiSt Open Files - it does more than its name suggests) is pretty useful too.
fuser is useful too, and available on many Unixen. I've used "fuser -k" many times to find and kill rogue processes.
https://en.wikipedia.org/wiki/Lsof https://en.wikipedia.org/wiki/Lsof
https://en.wikipedia.org/wiki/Fuser_(Unix) https://en.wikipedia.org/wiki/Fuser_(Unix)
Edited for grammar.
- twic 9y agoOne of my favourite hacks is this script (which might well not work - it's flaky): https://bitbucket.org/twic/devtools/src/1b7a8f9ab849b36de70c6fe1cab2460fb2657c6d/bin/killfd?at=default&fileviewer=file-view-default https://bitbucket.org/twic/devtools/src/1b7a8f9ab849b36de70c... Which, given a specification of a filehandle (eg an IP address or path) uses lsof to determine the PID of the owning process and the numeric value of the filehandle, and then uses gdb to attach to that process and close it. It's a crude but simple way of exercising error-handling code.
- vram22 9y agoInteresting one. Are you running Elixir in the last line? the iex?
- twic 9y agoThat's this line, i think: sudo gdb -batch -n -iex "set auto-load off" -p $TARGET_PID -ex "call close(${TARGET_FD})" The -iex is a flag which executes a command on startup: -init-eval-command command -iex command Execute a single GDB command before loading the inferior (but after loading gdbinit files). See Startup. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/File-Options.html#File-Options https://sourceware.org/gdb/current/onlinedocs/gdb/File-Optio...
- vram22 9y agoGot it now, thanks.