Tuesday, January 15, 2008

unix process and ports on solaris

Hello there , i was troubleshooting an issue with the Tibco Message listeners and to be honest i am a newbie at this. all these years i have working on weblogic JMS and Sonic JMS to some extent. things are so cool in JEE world with MDB and JMS servers having a rich console to monitor what is happening. but unfortunately not the case with legacy messaging code that we had, wherein the listeners were started using a shell script invoking tibco java API using "nohup" command (will get back to this shortly). There is a tibco daemon process which is analogous to JMS server and the "subject" is topic/queue in a JMS world. anyways my focus of today's blog is not to write on Tibco but rather on unix commands that aided me in my debugging. but as i get to know more about Tibco Rendezvous (messaging product) i will definitely pen it down.

coming back to "nohup", this command allows you to launch a process without associating the process with shell or a terminal. typically its used with & in this fashion

$ nohup ./startServer.sh &

hence even if you exit from your telnet session, the process will continue to run. in some sense it behaves as a daemon process.

Then i needed to find the process listerners, so ps -ef | grep "name" should work. but somehow it couldn't give the full path of the shell script that launched the process. luckily it was a solaris host and this command did the trick

$/usr/ucb/ps -auxww | grep "name"

in case you wanna find out which "ps" command is being invoked use this

$which ps

will give you the path of the executable.

one more thing which drew me crazy was, in our solaris v5.8, all Java threads were being displayed by the ps command. by looking at the ps output last column, "native_threads" word will indicate that its a thread and not a process.

next came the task of killing certain process that is listening to a port no

$lsof -i

the above command will give list of all processes that is using the port no.

one more useful command that you might want to look at his $netstat

in case you are interested to find out how you are processes are using CPU and memory use $top

and of course the easiest of them all is to kill a process $kill -9 :)

well, these are some of the new commands that i learnt today, list is endless though.

have fun,
Venkat