Created
August 28, 2014 05:47
-
-
Save kadishmal/e03efafdd3996f5e6394 to your computer and use it in GitHub Desktop.
fd_count.sh: Watch open file descriptors count for a process.
This file contains 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/sh | |
# Usage: sh fd_count.sh PID | |
RE='^[0-9]+$' | |
while :; do | |
clear; | |
for pid in `ps aux | awk '{print $2}'`; do | |
if [[ $pid =~ $RE ]] ; then | |
FCOUNT=`lsof -p $pid | grep -v " txt " | wc -l`; | |
echo "PID: $pid $FCOUNT"; | |
fi | |
# done | sort -nk3 | grep $1; | |
done | grep $1; | |
sleep 5; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment