Operating System - HP-UX
1753964 Members
7520 Online
108811 Solutions
New Discussion юеВ

How to identify any processes running on a huge directory structure?

 
SOLVED
Go to solution
Steve Post
Trusted Contributor

Re: How to identify any processes running on a huge directory structure?

LIST=`/usr/bin/find /A/perl -name "*sl" -type f -print `

for X in $LIST
do
unset running
running=`fuser $X 2>>/dev/null`
if [ -n "${running}" ] ; then
print X is $X and has pids of $running
# I can even take it a down a level
for P in $running
do
ps -fp $P
done
echo "------------------------\n"
fi
done

I used this. With it, I discovered a dynamic shared object of perl was running with apache on 3 development websites. I stopped the 3 and whammo. No use anymore.

I've never used lsof before. If I did, I probably would replace the fuser command with it.

This script would be a performance hog. I would not not want to run it on a whim.

But I minimized the affect by just looking at files ending .sl. I could see from my first accident, (ahem), that these were the only ones in use.
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to identify any processes running on a huge directory structure?

Hi (again) Steve:

If you backup this directory with a utility that restores the lastaccesstime stamp of the files backed up, then consider using 'find' to see what has been accessed since some point in time.

For that matter, you still might glean some useful information if, for example, your complete backups were done weekly.

Regards!

...JRF...
Steve Post
Trusted Contributor

Re: How to identify any processes running on a huge directory structure?

...why can't I do this???

cd /A
find perl -atime -1 -type f -print

if something shows up, I know it's in use?

Or
find perl -atime +600 -type f -print >old
find perl -type f -print > all
diff old all | more


James R. Ferguson
Acclaimed Contributor

Re: How to identify any processes running on a huge directory structure?

Hi (again) Steve:

> # find perl -atime -1 -type f -print
> if something shows up, I know it's in use?

Well, you know that it *has been* *accessed* (read or executed) not necessarily that it is in-use.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: How to identify any processes running on a huge directory structure?

>if something shows up, I know it's in use?

You can touch a reference file of an hour or so ago and then find files:
-neweram ref-file