Last active
September 22, 2020 15:30
-
-
Save tstout/4c93e58a14ae50625a3528e6a7b41bb2 to your computer and use it in GitHub Desktop.
close-socket #bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| IFS=$'\n' | |
| for socket in $(lsof -p 361 | grep IPv | grep -v LISTEN) | |
| do | |
| IFS=' ' read -r pname pid host fd _ <<< $socket | |
| echo "close(${fd%?}) for process $pid" | |
| gdb --batch-silent -p $pid --eval-command="call close(${fd%?})" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment