DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Forums
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Reader Tips 

Port-Clearing With LSOF

OSXFAQ Reader Tip By Geoff Saulnier

lsof is a useful command if you know that a port you want to use is being held by something, but you don't know what. I state this reason for using it simply because it is the most common reason I find myself resorting to lsof to resolve. Some exchange connectivity applications seem to have processes that hang and don't release their port, but you're not always sure which port they grabbed when they started until another process refuses to start as it cannot connect via its hard-coded port.

eg: Orc connection to Milan covered warrants (MCW) dies, usually due to some crud from the exchange that the orc marketlink binary can't deal with. On restart, it might fail and fall over again. lsof would reveal that rv (the TIBCO rendez-vous listener that listens to the data coming form the GAM server) is holding the port that the marketlink needs to restart. ps yeilds the command, kill and restart rv with the command obtained from ps, restart the marketlink, wait for it to synch, and you're away. In the latest versions of Orc, though, you need to delete ownorders in the database using dbaccess to get it to restart, or it just keels over again! Bug.

lsof lists the open files on the system (files = streams = connections = devices = many other things in unix-land) so that you can figure out what is holding the port. Kill that command and the port is free.

rpcinfo man page can give you other port-clearing ideas, but you will probably still need to resort to lsof if rpcinfo does not yield enough information.

The man page for lsof on Jaguar is one of the most complete I have ever seen - on any command!

Enjoy :-)

If you would like to see your tip here send it to us at contribute@osxfaq.com, You could be famous too!!

Copyright © 2000-2008 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.