Re: List Opens for OSS file



Brandon Jenkins wrote:
Does anyone have a working version of LSOF running on a blade (J-
Series)?
http://en.wikipedia.org/wiki/Lsof

I have the following script for this:

#!/bin/ksh

# Copyright (C) 2005, 2009, 2011 and unsupported by
# Joachim Schmitz <schmitz <at> hp <dot> com>

# Version History:
# 08Mar2005: first version
# 14Dec2009: additions as per KBNS Solution gcsc29461
# 24Mar2011: improvments as per KBNS Solution gcsc29461

for f in $@
do
if [ -f "$f" ]
then
l=$(gtacl -p fup listopens $(gname -s "$f") | tail +4 |
awk '{print $NF}')
if [ ! -z "$l" ]
then
f=$(gname "$f")
l=$(pname "$l" 2>/dev/null | cut -d: -f2 | head -1)
if [ -z "$l" ]
then
printf "%s is open\n" "$f"
else
printf "%s is opened by %s\n" "$f" "$l"
fi
fi
else
echo "${0##*/} works on files only and \"$f\" is not a file"
&2
fi
done



Bye, Jojo


.