krypted.com

Tiny Deathstars of Foulness

You can kill a process using the kill command. You can use lsof with -n to see the processes that have connections to a file. So, here, you can see lsof showing all files with an open connection:

lsof -n

You can also use the-c option to constrain output to a specific string. The kill command can then use the lsof command to kill all those processes, as follows:

kill -HUP $(lsof -n -c /tty/i -t)

Free your files…

June 26th, 2015

Posted In: Mac OS X, Mac OS X Server, Mass Deployment, Ubuntu, Unix

Tags: , , ,

From time to time you’ll see an error that “daemon: bind(8) failed errno=48 (Address already in use)” when trying to promote a Mac OS X Server to be an Open Directory Master. The address in question is usually fine and the DNS usually checks clean with changeip:

changeip -checkhostname

However the error recurs no matter what you do, even if you try and change the name of the Open Directory Master or the address you still usually end up seeing the same error. If it isn’t the address or the name then could it be the port? If you run lsof to see about that whole ldap port:

lsof -i | grep ldap

Then you’ll end up seeing something like a mail server or third party tool taking 389 first. So, the error should probably read “port already in use” rather than “address already in use.” Disable ldap or move ldap to some other port with the other service, or spin up a new IP and move ldap to that IP for the other service and re-promote and viola, you’re golden. Good luck!

September 8th, 2013

Posted In: Mac OS X Server

Tags: , , , , , , , , , ,

lsof is a command that can be used to list all the open files.  You can use grep to narrow down the listing to only those that match a certain string.

December 22nd, 2007

Posted In: Mac OS X, Unix

Tags: , , ,

To see processes with open (aka ESTABLISHED) connections:

lsof -i | grep ESTABLISHED

February 6th, 2006

Posted In: Mac OS X

Tags: , , ,