Stefan Mayr wrote:
Am 01.08.2012 19:10, schrieb Shaw, Ray V CTR (US):
I'm starting up Tomcat 7.0 on RHEL6 with the following init script:

#!/bin/bash
#
# chkconfig: 235 80 20
# description: Takes care of starting and stopping Tomcat.

CATALINA_HOME="/opt/tomcat7"
export JAVA_HOME="/usr/java/jdk6-64/"

case "$1" in
         'start')
/bin/su tomcat -c "$CATALINA_HOME/bin/startup.sh -security"
                 ;;
         'stop')
                 /bin/su tomcat -c $CATALINA_HOME/bin/shutdown.sh
                 ;;
         *)
                 echo "usage: $0 {start|stop}"
                 ;;
esac

If I use sudo -s (or -i) to get a root shell, I can use this script to start and stop Tomcat.

If I invoke this script directly via sudo, i.e. "sudo /sbin/service tomcat7 stop", stopping Tomcat works. Starting does not; Tomcat gives the usual output to the terminal, creates or touches catalina.out (but writes nothing to it), and then instantly exits. This is a problem, because I need to allow the Web admin to start/stop Tomcat without giving them everything.

Has anyone seen anything similar to this before? /var/log/secure isn't showing anything out of the ordinary (and obviously, the commands are being run).


Could you post your tomcat output when you try to start it? You should also check differences in your environment variables when using different methods.

I have not really worked this out in detail, but something up there is making me suspicious : you are not exporting $CATALINA_HOME, and you are using one additional level of quotes in your start command, as compared to your stop command.
Are you sure that when the start command actually runs, it sees the same 
CATALINA_HOME value ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to