How to close a unix port | Unix Linux Forums | AIX

  Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

How to close a unix port

AIX


Tags
aix, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-11-2011
mrn6430's Avatar
mrn6430 mrn6430 is offline
Registered User
 
Join Date: May 2011
Last Activity: 29 August 2014, 2:46 PM EDT
Location: USA
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
Network How to close a unix port

I have an issue with port 7331 on our Unix box that is hung, It is stuck in a listen status:


Code:
ukh-o2-jcaps1:/tstjcaps6/apptest2> netstat -a|grep 7331
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.59010       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.59215       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.59459       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.59668       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.59912       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.60130       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.60361       CLOSE_WAIT
tcp4    1019      0  ukh-o2-jcaps1.7331     10.230.6.7.60578       CLOSE_WAIT
tcp        0      0  *.7331                 *.*                    LISTEN


the lsof shows no PID id is using it. Nothing is displayed. It looks like it is stuck and we need to close it. How do we force close a port w/o a PID process is using it? Thanks

Moderator's Comments:
edit by bakunin: please use CODE-tags when posting code or terminal output to enhance readability. Thank you.

Last edited by bakunin; 05-12-2011 at 11:31 AM.. Reason: code-tags
Sponsored Links
    #2  
Old 05-11-2011
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 1 September 2014, 3:53 AM EDT
Location: Ashburn, Virginia
Posts: 9,923
Thanks: 60
Thanked 433 Times in 258 Posts
I have always been able to find a process doing a listen. Are you running lsof as root? Did you use lsof -i :7331 ? Also what OS are you using?
Sponsored Links
    #3  
Old 05-11-2011
mrn6430's Avatar
mrn6430 mrn6430 is offline
Registered User
 
Join Date: May 2011
Last Activity: 29 August 2014, 2:46 PM EDT
Location: USA
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
Not in this case. we have non displayed for this port. We fixed the issue by rebooting the server, but there got to be a quicker way to close a runaway port / orphan port. it is AIX VER 5.3. tl11 sp4
    #4  
Old 05-11-2011
rmcc4444 rmcc4444 is offline
Registered User
 
Join Date: May 2011
Last Activity: 14 September 2011, 11:28 PM EDT
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mrn6430 View Post
I have an issue with port 7331 on our Unix box that is hung, It is stuck in a listen status:

ukh-o2-jcaps1:/tstjcaps6/apptest2> netstat -a|grep 7331
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.59010 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.59215 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.59459 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.59668 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.59912 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.60130 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.60361 CLOSE_WAIT
tcp4 1019 0 ukh-o2-jcaps1.7331 10.230.6.7.60578 CLOSE_WAIT
tcp 0 0 *.7331 *.* LISTEN


the lsof shows no PID id is using it. Nothing is displayed. It looks like it is stuck and we need to close it. How do we force close a port w/o a PID process is using it? Thanks
Try these..


Code:
 netstat --tcp --udp --listening --program

or


Code:
 fuser -v 7331/tcp

That should tell you what program is associated with the port.

This should all tell you a bit more and now you can kill it.


Code:
 fuser -vk 7331/tcp

Sponsored Links
    #5  
Old 05-12-2011
mrn6430's Avatar
mrn6430 mrn6430 is offline
Registered User
 
Join Date: May 2011
Last Activity: 29 August 2014, 2:46 PM EDT
Location: USA
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
when i run fuser -v 7331/tcp i get this error:

fuser: Not a recognized flag: v
Illegal option ignored.
7331/tcp: A file or directory in the path name does not exist.
Sponsored Links
    #6  
Old 05-12-2011
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 1 September 2014, 3:53 AM EDT
Location: Ashburn, Virginia
Posts: 9,923
Thanks: 60
Thanked 433 Times in 258 Posts
Those options work in Linux. This is not exactly a shell scripting issue. I am going to move this thread to the AIX forum. Maybe the AIX experts can help you out.
Sponsored Links
    #7  
Old 05-23-2011
mrn6430's Avatar
mrn6430 mrn6430 is offline
Registered User
 
Join Date: May 2011
Last Activity: 29 August 2014, 2:46 PM EDT
Location: USA
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
any takers please?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
when parent process close, how to close the child? omega666 Programming 3 04-06-2011 04:38 PM
close tcp port raidzero UNIX for Dummies Questions & Answers 1 09-24-2008 02:16 PM
Unix port status calamine UNIX for Advanced & Expert Users 0 05-22-2007 12:51 AM
Should a UNIX daemon process close open fds? kunalashar UNIX for Dummies Questions & Answers 1 10-24-2002 09:10 AM
Need to port C dll to UNIX ana_puri Programming 2 12-09-2001 11:50 PM



All times are GMT -4. The time now is 07:18 AM.