Title: RPC to stop and start instances of Tomcat

Gday

I have been trying to stop and start Tomcat with an RPC framework (using perl and
modules such as Penguin and PlRPC).

Upon running a daemon process that simply listens for requests to stop and start
a tomcat instance, I find that the stopping and starting works fine.

Say then that the daemon was listening on port 2000.

If I kill the daemon, then I find that the last restarted instance of Tomcat has bound
itself to port 2000. 

So - step by step:

[java@myhost bin]$ ps -ef| grep pen
java     19239 19003  0 15:28 pts/0    00:00:00 perl ./penguind
java     19512 19003  0 15:31 pts/0    00:00:00 grep pen

So - my RPC listener has pid 19239.

[java@myhost bin]$ netstat -lp | grep 18118
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 *:2000                 *:*                     LISTEN      19239/perl         
tcp        0      0 *:2000                 *:*                     LISTEN      19239/perl         

And it is listening on port 2000.

[java@myhost bin]$ kill 19239
[1]+  Terminated              ./penguind

I kill the daemon.

[java@myhost bin]$ netstat -lp | grep 18118
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 *:2000                 *:*                     LISTEN      19440/java         

Then I find that the port is bound up to the tomcat instance that was last restarted.

I have nohupped scripts, backgrounded them as well, used fork && exit to try to dis-associate
the perl code from the tomcat stop|start scripts.  Nothing at all seems to stop there being
a parent|child relationship between the perl listener and tomcat - which seems to me to be
the only way that tomcat will bind to the port that the perl code was listening on. 

What is going on??  This behaviour is displayed when using penguin and when using plrpc.

Any ideas?

thanks,
Abhinav

 ~~~~   __o       Abhinav Keswani
  ~~ ~ _\<,_      Unix Systems Administrator
      (^)/(^)     News Interactive
                  02 9004 5598

Reply via email to