Sponsored Content
Full Discussion: Port used needs to be killed
Operating Systems Solaris Port used needs to be killed Post 302125244 by zazzybob on Wednesday 4th of July 2007 07:39:04 PM
Old 07-04-2007
pfiles is the command you're thinking of under Solaris
Code:
# pfiles PID | grep INET
        sockname: AF_INET xxx.xxx.xxx.xxx  port: xxxx

Try something like this if you don't have lsof (or just install lsof....)
Code:
#!/bin/bash

# use this where lsof (for lsof -i tcp:<port>) isn't available

AWK="/usr/bin/awk"
ECHO="/bin/echo"
PARGS="/usr/bin/pargs"
PFILES="/usr/bin/pfiles"
PS="/usr/bin/ps"
SED="/usr/bin/sed"

${PS} -ef | ${SED} '1d' | while read PS_LINE; do
   PS_PID=$( ${ECHO} "${PS_LINE}" | ${AWK} '{print $2}' )
   PS_PROC=$( ${PARGS} ${PS_PID} | ${SED} -n '1p' | ${SED} 's/^[0-9][0-9]*:[    ]*\(.*\)$/\1/' )
   PORT_USAGE=$( ${PFILES} ${PS_PID} | ${AWK} '/AF_INET/ { printf( "\t%s(%s)\n", $3, $5 ) }' )
   if [ "${PORT_USAGE}" != "" ]; then
      ${ECHO} "${PS_PROC} [PID: ${PS_PID}]"
      ${ECHO} "${PORT_USAGE}"
   fi
done

exit 0

Cheers
ZB
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

process not getting killed

I have a process that is in the sleeping state "S" and I have tried to stop it with a run control script that I use to stop/start it - but it does not stop. I have tried kill -9 <PID of process> with no change. I imagine that this process is sleeping with the kernel. It does not respond to... (5 Replies)
Discussion started by: finster
5 Replies

2. UNIX for Advanced & Expert Users

ls is being killed

Hi There, Hope anyone can give me a hand on AIX oslevel -r 5300-05 Try to "ls *sh" from folder and it return killed, is there any clue on that? 1. perform ls and count ls * | wc -l 0 ksh: 561582 Killed 2. without provide "*" wildcard, the result can be return ls | wc ... (7 Replies)
Discussion started by: darkrainbow
7 Replies

3. Shell Programming and Scripting

Killed by signal 15.

Hi all I have Master script, Main script ,and 4 Child script. Master.sh #!/bin/bash /export/home/user/Main.shMain.sh #!/bin/bash /export/home/user/Child1.sh & /export/home/user/Child2.sh & /export/home/user/Child3.sh & /export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies

4. Solaris

How to enable Serial port on ILOM, when Network Port is enabled in parallel

Hi Everyone, In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 Replies

5. What is on Your Mind?

Has Oracle killed HP-UX

Has Oracle killed HP-UX with their gambit of telling the public they would no longer support Itanium? The company I work for in the Dallas, TX area has had several openings for HP-UX administrators and we're having such a tough time finding qualified people to fill them. I have been searching job... (3 Replies)
Discussion started by: keelba
3 Replies

6. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

7. Solaris

Cabling and adapters to communicate to service processor serial port from Windows PC with USB port.

Hello, I have an unloaded T5140 machine and want to access the ILOM for the first time and subsequently the network port after that., and then load Solaris 10 the final January 2011 build. The first part is what confuses me -the cabling. I am coming from a Windows machine (w/appropriate... (5 Replies)
Discussion started by: joboy
5 Replies

8. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

9. UNIX for Beginners Questions & Answers

Bash script, find the next closed (not in use) port from some port range.

hi, i would like to create a bash script that check which port in my Linux server are closed (not in use) from a specific range, port range (3000-3010). the print output need to be only 1 port, and it will be nice if the output will be saved as a variable or in same file. my code is: ... (2 Replies)
Discussion started by: yossi
2 Replies
GZEXE(1)                                                      General Commands Manual                                                     GZEXE(1)

NAME
gzexe - compress executable files in place SYNOPSIS
gzexe name ... DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a penalty in performance). For example if you execute ``gzexe /usr/bin/gdb'' it will create the following two files: -rwxr-xr-x 1 root root 1026675 Jun 7 13:53 /usr/bin/gdb -rwxr-xr-x 1 root root 2304524 May 30 13:02 /usr/bin/gdb~ /usr/bin/gdb~ is the original file and /usr/bin/gdb is the self-uncompressing executable file. You can remove /usr/bin/gdb~ once you are sure that /usr/bin/gdb works properly. This utility is most useful on systems with very small disks. OPTIONS
-d Decompress the given executables instead of compressing them. SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the PATH environment variable to find gzip and some standard utilities (basename, chmod, ln, mkdir, mktemp, rm, sleep, and tail). BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases, using chmod or chown. GZEXE(1)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy