Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2003 18:14:26 +0100
From:      Paul Robinson <paul@iconoplex.co.uk>
To:        Varshavchick Alexander <alex@metrocom.ru>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to delete unix socket entries
Message-ID:  <20030624171426.GU34365@iconoplex.co.uk>
In-Reply-To: <Pine.GSO.4.33.0306242058590.9816-100000@apache.metrocom.ru>
References:  <Pine.GSO.4.33.0306242058590.9816-100000@apache.metrocom.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 24, 2003 at 08:59:49PM +0400, Varshavchick Alexander wrote:

> I had a wrong-behaved server application which opened a unix socket to
> respond to incoming connections, so that after the socket was opened, the
> application core dumped each time it was launched. As a result, 'netstat
> -f unix' now shows a lot of not-needed active entries. Is there any way to
> delete them, or will they eventually die by themselves?

A "better" way to do this is to use sockstat:

paul@hannibal:~> sockstat -u
USER     COMMAND    PID   FD PROTO  ADDRESS
root     screen   30084    4 stream /tmp/screens/S-paul/30084.ttyp0.hannibal
root     pure-ftp 22112    3 dgram  syslogd[67]:3
root     named    56824    3 dgram  syslogd[67]:3
root     ntpd     11575    3 dgram  syslogd[67]:3
mysql    mysqld   53779    6 stream /tmp/mysql.sock
root     syslogd     67    3 dgram  /var/run/log

paul@hannibal:~>

you then *know* which are the safe sockets to destroy. If it's a stream 
socket, you've got a file that you can rm - they're not going anywhere of 
their own accord.*

The short answer then is "rm them, but make sure you rm the right ones".

-- 
Paul Robinson

* If you reboot the machine, depending on how things are setup on your 
machine, /tmp and /var/tmp may or may not get rm'ed anyway, so the system 
has "cleared" the sockets on your behalf.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030624171426.GU34365>