Date Created: Mon 10-Dec-2007

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/



    How to determine which WebSphere or UNIX process (pid) is using a particular port

    The script below is very useful if you have a port conflict on starting a WAS process. If you are on a shared environment i.e test / dev you may have many WebSphere process running and if standards are not used you may get a port conflict. This utility can help you find what process is using a particular port. Once you have the pid (process id) then you can run pargs <pid> to find out details of what WAS process or other process is running as a particular process and ultimately using the port you are querying.

    Developed for Solaris:

    #!/bin/ksh
    #
    # Orf Gelbrich
    # 7-30-2003
    # find from a port the pid that started the port
    #
    # Need to be root to check other folk's PID's out
    #
    line='-------------------------------------------------------------------------'
    pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}')


    # Prompt users or use 1st cmdline argument
    if [ $# -eq 0 ]; then
    read ans?"Enter port you like to know pid for: "
    else
    ans=$1
    fi


    # Check all pids for this port, then list that process
    for f in $pids
    do
    /usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
    if [ $? -eq 0 ] ; then
    echo $line
    echo "Port: $ans is being used by PID:\c"
    /usr/bin/ps -ef -o pid -o args | egrep -v "grep|pfiles" | grep $f
    fi
    done
    exit 0


    ----------------------------------------------------------------

    Try this for port 60000 or 600001 on Linux

    ps -ef | grep --regexp="`netstat -nlept | awk '/60000/ || /60001/ {split($9,t,"/"); print t[1]}'`"

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories