Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to find Open Files by a Process Solaris 10

745825Aug 12 2013

Hi,

Hope you are doing well.

I'm trying to get open files by a process in solaris 10 using "pfiles" with below command:

pfiles -n `ps | grep -i "data -log"  | grep -v grep | grep -i uatrate | awk '{print $2}'` | wc –l

When I put this in some shell script like below then this command is not giving any output. Your assistance is required in this. Please guide me so that I can get the Count of Open files by some process.

I made some script, Its working fine but its giving the output for whole processes:

#!/bin/ksh

let "TOTAL_OPENED=0"

for A_PID in `ps | grep -i "data -log"  | grep -v grep | grep -i uatrate | awk '{print $1}'`; do

FILES_OPENED=`/usr/proc/bin/pfiles -n $A_PID 2>/dev/null| grep "ino:" | wc -l`

let "TOTAL_OPENED = TOTAL_OPENED + $FILES_OPENED"

done

echo "Opened files = $TOTAL_OPENED"

Many Thanks in advance.

Imran Qasim.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 9 2013
Added on Aug 12 2013
0 comments
2,718 views