SUMMARY: Finding network process name/pid



On Fri, 2007-08-17 at 11:01 +0100, John Horne wrote:

The 'netstat -an' command will show me that processes are using certain
network ports. E.g. 'netstat -an | grep 53' will show me that a DNS name
server is running:

127.0.0.1.53 Idle
192.168.177.1.53 Idle
192.168.177.1.53 *.* 0 0 49152 0 LISTEN

But how can I find out the process (executable) pathname or its PID?

Thanks for replies go to:

Juraj Lutter
Loris.Serena
francisco roque
Ric Anderson
Polachak, Jason
Edward Scown
John.Hallman
Rahul Sen
Crist Clark
Tim Wright
John Leadeham

Some people replied suggesting using 'lsof', but as mentioned I didn't
want to do this. The other suggestion was to use the 'pfiles' command.
This will indeed show the executable name that is using a port, but the
man page for pfiles does contain a warning:

=====================================================
The following proc tools stop their target processes while
inspecting them and reporting the results: pfiles, pldd, and
pstack.

A process can do nothing while it is stopped. Stopping a
heavily used process in a production environment, even for a
short amount of time, can cause severe bottlenecks and even
hangs of these processes, causing them to be unavailable to
users. Some databases could also terminate abnormally. Thus,
for example, a database server under heavy load could hang
when one of the database processes is traced using the above
mentioned proc tools. Because of this, stopping a UNIX pro-
cess in a production environment should be avoided.
=====================================================

In this instance I would need to loop through all the processes in /proc
(perhaps using 'ptree -a'), and then use pfiles on each PID to see if it
has the relevant port open. If it does, then extract the executable
pathname. It does work, but my concern, given the above warning, is that
many processes may need to be stopped before the relevant executable is
found. Probably not a problem if the server is not under load.




John.

--
---------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: John.Horne@xxxxxxxxxxxxxx Fax: +44 (0)1752 233839
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



Relevant Pages

  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Can you do the following on uksccmads01 ... The problem may actually have nothing to do with the new server but the ... From a command prompt try and see if you get any additional info ... Skipping site UK-CCM, this site is outside the scope ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Can you do the following on uksccmads01 ... The problem may actually have nothing to do with the new server but the ... Active Directory Forest Replication GUIDs Found: ... From a command prompt try and see if you get any additional info ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Default Server: uksccmads01.jw-uk.jameswalker.co.uk ... Output from dnslint on uksccmads01: No erros found, ... Active Directory Forest Replication GUIDs Found: ... From a command prompt try and see if you get any additional info ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Both forward and reverse zones and server records have the correct IP ... Once you have found the error then on both servers, from a command prompt, ... Skipping site UK-CCM, this site is outside the scope provided by ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Then change the secondary DNS to the other site DNS server. ... Skipping site UK-CCM, this site is outside the scope provided ... command line arguments provided. ...
    (microsoft.public.windows.server.active_directory)