On Sat, 2006-05-13 at 12:36 +0000, Warren Wilder wrote:
> How do you check whether any of the running processes is using the
> shared library xxx.so?
> You could just kill all the processes, change to a different runlevel,
> or something like that, if you want to install a new version of a
> library and be safe about it. But what if you just wanted the
> information?
Hmmm... how about this:
#!/bin/bash
for i in `ps -e -o cmd= | cut -d \ -f 1 | sed -e "/^[\[-]/d" | less`;
do
fn=`which $i`
if [ -n "$fn" ]; then
ld=`ldd $fn 2>/dev/null | grep -i $1`
if [ -n "$ld" ]; then
echo "running process $fn uses $1"
fi
fi
done
This little bash script takes as its only argument whatever library you
request, e.g.:
whatuses orbit
(note that it is not case-sensitive)
would return all currently running gnome programs that use libORBit
--
Peter B. Steiger
Cheyenne, WY
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page