ÎÒ¾³£ÔÚSolaris·þÎñÆ÷ÉÏÆôºÃ¼¸¸öTomcatºÍGlassFish, »áÓöµ½"¶Ë¿Ú"±»Õ¼ÓõĴíÎó, ºÜÄÑÖ±½ÓÓÃÃüÁîµÃÖªÕâ¸ö¶Ë¿Úµ½µ×±»Äĸö½ø³Ì»òÕßÓ¦ÓóÌÐòÕ¼ÓÃÁË£¬ Alex¸øÁËÎÒÈý¸ö½â¾ö·½°¸¡£¸½´øËµÒ»¾ä£¬ÎÒÖ»³¢ÊÔÁ˵ÚÒ»ÖÖ·½°¸£¬Ï൱µÄºÃÓ᣶øAlexÔ¸Ò⻨ʱ¼äÕÒ½â¾ö·½°¸£¬È´²»Ô¸Ò⻨¼¸·ÖÖÓ°ÑÕâЩºÃ¶«Î÷д³öÀ´£¬½á¹û¾ÍÊDZ»ÎÒ·¢±í³öÀ´¡£¹¦ÀÍ»¹ÊÇÒª¹éAlex Peng.
µÚÒ»ÖÖ·½°¸£º
1¡£Ê¹ÓÃÏÂÃæshell script£¬ÏȽ¨Á¢Ò»¸öport.shÎļþ:
# more /tmp/port.sh
#!/bin/sh
for pid in `ls /proc`
do
pf=`/usr/bin/pfiles $pid 2>/dev/null`
if echo $pf | grep $1 > /dev/null 2>&1
then
echo $pid
/usr/bin/pargs $pid
fi
done
2¡£ÔËÐÐport.sh, ´«Èë¶Ë¿ÚºÅ£¬±ÈÈç53250 :
# /tmp/port.sh 53250
3¡£ÔËÐнá¹ûÈçÏ£º
1225
1225: /usr/lib/thunderbird/thunderbird-bin -UILocale zh-CN
-contentLocale CN
argv[0]: /usr/lib/thunderbird/thunderbird-bin
argv[1]: -UILocale
argv[2]: zh-CN
argv[3]: -contentLocale
argv[4]: CN
4212
4212: /bin/sh /tmp/port.sh 53250
argv[0]: /bin/sh
argv[1]: /tmp/port.sh
argv[2]: 53250
µÚ¶þÖÖ·½°¸£º
ÏÂÔØ"lsof" package¡£µ«¿ÉÄܲ»ÊʺÏÿÖÖÇé¿ö
µÚÈýÖÖ·½°¸£º
ʹÓÃMDB
from socket info (netstat output), you can know its vnode
from vnode info, you can know which process owns it
from process info, you can know its args, so comes the result.