Author Topic: Handle counter  (Read 1214 times)

Offline Alexi

  • Acquaintance
  • *
  • Posts: 15
    • View Profile
Handle counter
« on: August 10, 2008, 11:00:18 PM »
For Crat and Shadyman per a discussion on handles... it's sensitive and picky but it is hackable and can get you part of the way there perhaps...

#!/bin/bash

TEMP=`ls /proc/`
TEMP=`echo $TEMP | sed "s/[a-zA-Z]//g" | sed "s/[.]//g"`
NR_HANDLES=0

for PID in $TEMP;
do
NR_PID=`/usr/sbin/lsof -p $PID | wc -l`
NR_HANDLES=$[$NR_HANDLES+$NR_PID]
done

echo $NR_HANDLES



I get a few errors and I accept them depending on which system I run it on... I got 583 on my last run on a Centos box where I was running Trek...and some other LD test dev stuff.

Alexi