Hacker News new | past | comments | ask | show | jobs | submit login

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/Fuser_(Unix)

Edited for grammar.




One of my favourite hacks is this script (which might well not work - it's flaky):

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.


Interesting one.

Are you running Elixir in the last line? the iex?


That'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-Optio...


Got it now, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: