Get the Process ID from Port Number - Solaris

Get the Process ID from Port Number - Solaris

1 - Create a shell scripts with below content

bash-4.4$ cat get_port_pid.sh
#!/bin/bash

# Get the process which listens on port

# $1 is the port we are looking for

if [ $# -lt 1 ]
 then
 echo "Please provide a port number parameter for this script"
 echo "e.g. $0 22"
 exit
 fi

echo "Greping for your port, please be patient (CTRL+C breaks) ... "

for i in `ls /proc`
 do
 pfiles $i | grep AF_INET | grep $1
 if [ $? -eq 0 ]
 then
 echo Is owned by pid $i
 fi
 done

2 - Execute the shell scripts

  
bash-4.4$ get_port_pid.sh 'port_number'


Example: get_port_pid.sh 1521
                get_port_pid.sh 22
appsdbahelp

17+ years of experience in Oracle Database, Oracle Cloud Infrastructure(OCI), Oracle EBS on Cloud, Oracle E-Business Suite, DevOps tools, Oracle WebLogic, Oracle Application Server, Oracle Access Manager and various Operating System flavors including Redhat Linux, UNIX (Solaris, HP-UX) and Windows. Expert in Oracle9i/10g/11g/12c/19c database administration, upgrade, configuration and tuning. Experience in Oracle E-Business Suite technological stack, including architecture, installation, configuration, maintenance, tuning, cloning and patching procedures. Expert in Oracle Cloud Infrastructure(OCI), Oracle EBS On Cloud and Oracle EBS Cloud Manager Experience with Oracle Cloud Solution and Expert of Oracle ERP/Oracle HCM Cloud deployment Experience in Terraform, JSON and chef cloud infrastructure automation framework Knowledge of ASM, Data Guard, Real Application Cluster, Exadata and Exalogic Knowledge of Oracle Enterprise Manager(OEM) Grid Control, Oracle WebLogic, Oracle Internet Directory, Oracle Access Manager and Apache Ability to analyze problem, develops solutions and bring program/project execution to completion.

Post a Comment

Previous Post Next Post