while [ 1 ];
do
date;
cat /proc/loadavg;
ps -Leo state,args |
awk ' $1 ~ /(D|R)/ {state[$0]++} \
END{ for (j in state) {printf "%s - %d\n", j, state[j]}}' |
sort -k 2;
echo "---";
sleep 5;
done
There is not PID and args are included in the output list as a whole. worried for number of processes.
One more thought. Dropping "
$1 ~ /(D|R)/" can be useful in case of problem with total number of processes. But then the whole command should be a bit modified, so the results are sorted by number of processes. Simplified version would look like this one:while [ 1 ];
do
ps -Leo state,args |
awk ' $1 ~ /(D|R)/ {state[$0]++} \
END{ for (j in state) {printf "%d - %s\n", state[j], j}}' |
sort -n;
echo "---";
sleep 5;
done
No comments:
Post a Comment