tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric B." <>
Subject Tomcat 6.0.26 startup scripts changed from 6.0.18
Date Thu, 08 Apr 2010 19:16:36 GMT

I am trying to upgrade to 6.0.26 and noticed that the startup scripts have 
changed slightly.  One of the issues that I am having is that the new startup script now checks for the existance of the CATALINA_PID 
file prior to starting up, and if it exists, it aborts.

My problem is that I am creating my pid file in my /var/run directory, which 
is, by default/design, root access only.  However, I launch the 
startup script under a "tomcat" user that has very limited read/write access 
on the system.

So what my init.d script currently does is pre-create an empty pid file in 
the /var/run directory, then changes ownership of it to "tomcat" so that 
tomcat can then update it with the actual pid of the tomcat process.

Given that there is no way for the startup script to write to the /var/run 
directory, my options are fairly limited without modifying it.  1) Change 
the location of the pid file.  2) Make the /var/run directory tomcat 
writable by default (via acl or by mode permissions)  Neither option 
particularly appeals to me.

The fastest solution I have come up with is to modify the condition in the script to check for the existence of a non-empty PID file, 
instead of just the existence of it (ie: use -s instead of -f).

ie:  modify the following from:

  if [ ! -z "$CATALINA_PID" ]; then
    if [ -f "$CATALINA_PID" ]; then
      echo "PID file ($CATALINA_PID) found. Is Tomcat still running? Start 
      exit 1

  if [ ! -z "$CATALINA_PID" ]; then
    if [ -s "$CATALINA_PID" ]; then
      echo "PID file ($CATALINA_PID) found. Is Tomcat still running? Start 
      exit 1

Is there a particular reason why this would be a bad implementation?  Should 
I submit a patch request for with this change?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message