I tried to run Tim's  original sh script under Solaris and it wouldn't
give me anything, so I wrote a version in Perl.  My script looks like
this:

-------------------------------------------------------------------------------
#!/usr/local/bin/perl

open (PIDFILE, "> logs/tomcat.pid");
print PIDFILE getppid();
close (PIDFILE);
--------------------------------------------------------------------------------

I also had to give fully qualified paths in both the Perl script and in
Runtime.getRuntime().exec() to get it to find the correct files.  Use
the original Java class that Tim wrote and just point it to the Perl
script.  Also, just call the Perl script--you don't need to call /bin/sh
first.  Make sure to chmod the script to executable, too.

Thanks for the Java code, Tim.  It works great now.

-Joel


Joel Sather
email: [EMAIL PROTECTED]
phone: 651-917-4719

>>> [EMAIL PROTECTED] 06/14/02 07:26AM >>>
Welcome to PID hell! I have this working on HPUX, if you are trying
this 
on another UNIX - I'm not sure what may happen but here are some hints

to track things down.

1) Make sure the directory you are starting tomcat you are typing 
bin/startup.sh. This ensures you will write the the correct log
directory.

2) My original version of the script was:
#!/bin/sh
echo $PPID > logs/tomcat.pid

This printed out the wrong PID since the first line created an extra 
shell process for the script to execute in. I wonder if 
Runtime.getRuntime().exec is creating "an extra process" which would 
cause you to get the wrong pid. If that is the case - I can't be of 
help. A Google search will probably provide a better solution than mine

for determining process id of a java program.


-Tim

Laura wrote:
> Hi,
> 
> I have installed your code in my Tomcat (4.0.2 + apache). 
> 
> But it doesn't seem to be correct. It writes in tomcat.pid a PID that
doesn't 
> seem to be correct: I have tried to do:
> 
> kill -9 PID (which is in the tomcat.pid) 
> 
> and the system tells me:
> 
> 
> bash: kill: (3977) - No such pid
> 
> 
> Where is the problem? 
> 
> 
> Thanks
> 
> 
> Laura
> 


--
To unsubscribe, e-mail:  
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to