Sam Dalton
Posts: 143
Nickname: samd
Registered: Jun, 2003
|
Sam Dalton is a Java Developer with ThoughtWorks in teh UK
|
|
|
|
Find which process is holding a port open on Solaris
|
Posted: Apr 5, 2005 4:02 AM
|
|
This is something that I seem to need to do increasingly more often when debugging connection problems in our application. Sadly, I have no access to run lsof (which would give me this information), so I use the following script:
echo "which port?> "
read port
for pid in `ps -ef -o pid | tail +2`
do
foundport=`/usr/proc/bin/pfiles $amp;pid 2>&1 | grep "sockname:" | grep "port: $port$"`
if [ "$foundport" != "" ]
then
echo "proc: $pid, $foundport"
fi
done
This needs to be run as the user that owns the process that you suspect, so it is not fool proof, but it has proved very useful so far!
Read: Find which process is holding a port open on Solaris
|
|